mirror of
https://github.com/lmika/postlist-for-micro.blog.git
synced 2025-08-02 15:56:08 +00:00
Compare commits
13 commits
Author | SHA1 | Date | |
---|---|---|---|
|
ea5168b7a2 | ||
|
ce7ec1e72a | ||
|
7a843af74a | ||
|
76675a7897 | ||
|
7168f63e77 | ||
|
0c1054e20f | ||
|
79e4f94a6c | ||
|
d94e08674f | ||
|
955af78300 | ||
|
24db0f2f7d | ||
|
f1f0d2ae7a | ||
|
3958da9c2e | ||
|
f26bc2d952 |
|
@ -1,35 +0,0 @@
|
||||||
---
|
|
||||||
name: 'deploy'
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
runs-on: docker
|
|
||||||
steps:
|
|
||||||
- name: Cloning repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Setup Github remote
|
|
||||||
run: |
|
|
||||||
mkdir -p $HOME/.ssh
|
|
||||||
echo "${{ secrets.PUBLISH_TO_GITHUB_KEY }}" > $HOME/.ssh/id_rsa
|
|
||||||
ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
|
|
||||||
chmod 600 $HOME/.ssh/*
|
|
||||||
chmod 700 $HOME/.ssh
|
|
||||||
git config --global user.name 'Leon Mika'
|
|
||||||
git config --global user.email 'lmika@lmika.org'
|
|
||||||
git remote add downstream git@github.com:lmika/postlist-for-micro.blog.git
|
|
||||||
- name: Push main to Github
|
|
||||||
run: |
|
|
||||||
git checkout main
|
|
||||||
git pull origin main
|
|
||||||
git push downstream main
|
|
||||||
- name: Push tags to Github
|
|
||||||
run: |
|
|
||||||
git fetch origin --tags
|
|
||||||
git push downstream --tags
|
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.DS_Store
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2025 lmika
|
Copyright (c) 2025 Leon Mika
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|
16
README.md
16
README.md
|
@ -1,3 +1,15 @@
|
||||||
# postlist-for-micro.blog
|
# Postlist for Micro.blog
|
||||||
|
|
||||||
A shortcode for post-list
|
A Micro.blog plugin for adding a shortcode for displaying a dynamic list of posts, similar to [Bear Blog's post macro](https://docs.bearblog.dev/embedding-blog-post-lists/).
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
To install on your Micro.blog site, go to the plugin directory and search for "postlist".
|
||||||
|
|
||||||
|
Once installed, you can add a post list to your site by using the `postlist` short-code:
|
||||||
|
|
||||||
|
```
|
||||||
|
{{< postlist >}}
|
||||||
|
```
|
||||||
|
|
||||||
|
See [the usage guide](https://postlist.micro.blog/) for how you can customise this post list, including filtering to posts matching a given category, or changing the sort order.
|
||||||
|
|
|
@ -5,17 +5,66 @@
|
||||||
{{- $pgr = (where $pgr "Params.categories" "intersect" (slice .)) -}}
|
{{- $pgr = (where $pgr "Params.categories" "intersect" (slice .)) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if (eq (.Get "order") "link-title" ) -}}
|
|
||||||
{{- $pgr = $pgr.ByLinkTitle -}}
|
{{- if (ne (.Get "order") "") -}}
|
||||||
|
{{- $order := split (.Get "order") " " -}}
|
||||||
|
{{- if (eq (index $order 0) "alpha" ) -}}
|
||||||
|
{{- $pgr = $pgr.ByLinkTitle -}}
|
||||||
|
{{- else if (eq (index $order 0) "date" ) -}}
|
||||||
|
{{- $pgr = $pgr.ByDate -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if (and (eq (len $order) 2) (eq (index $order 1) "desc")) -}}
|
||||||
|
{{- $pgr = $pgr.Reverse -}}
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
<ul class="postlist">
|
|
||||||
{{ range $pgr }}
|
{{- if (ne (.Get "limit") "") -}}
|
||||||
{{- if (ne .LinkTitle "") -}}
|
{{- $pgr = $pgr.Limit (int (.Get "limit")) -}}
|
||||||
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
{{- end -}}
|
||||||
{{- else if (ne .Summary "") -}}
|
|
||||||
<li><a href="{{ .RelPermalink }}">{{ .Summary | safeHTML | truncate 70 }}</a></li>
|
{{- if (eq (.Get "display") "content") -}}
|
||||||
|
{{ if templates.Exists "partials/_postlist/post-content-before.html" }}
|
||||||
|
{{ partial "_postlist/post-content-before.html" $pgr }}
|
||||||
|
{{ end }}
|
||||||
|
<div class="postlist postlist-display-content h-feed">
|
||||||
|
{{ range $pgr }}
|
||||||
|
{{ if templates.Exists "partials/_postlist/post-content.html" }}
|
||||||
|
{{ partial "_postlist/post-content.html" . }}
|
||||||
|
{{ else }}
|
||||||
|
<div class="h-entry">
|
||||||
|
{{ if .Title }}
|
||||||
|
<h2 class="p-name"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
|
||||||
|
{{ if .Params.custom_summary }}
|
||||||
|
<div class="p-summary">
|
||||||
|
<p>{{ .Summary | safeHTML }}<p>
|
||||||
|
</div>
|
||||||
|
{{ else }}
|
||||||
|
<div class="e-content">
|
||||||
|
{{ .Content }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
<div class="e-content">
|
||||||
|
{{ .Content }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
{{ if templates.Exists "partials/_postlist/post-content-after.html" }}
|
||||||
|
{{ partial "_postlist/post-content-after.html" $pgr }}
|
||||||
|
{{ end }}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
<li><a href="{{ .RelPermalink }}">{{ .Content | safeHTML | truncate 70 }}</a></li>
|
<ul class="postlist">
|
||||||
{{ end }}
|
{{ range $pgr }}
|
||||||
{{ end }}
|
{{- if (ne .LinkTitle "") -}}
|
||||||
</ul>
|
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||||
|
{{- else if (ne .Summary "") -}}
|
||||||
|
<li><a href="{{ .RelPermalink }}">{{ .Summary | safeHTML | truncate 70 }}</a></li>
|
||||||
|
{{- else -}}
|
||||||
|
<li><a href="{{ .RelPermalink }}">{{ .Content | safeHTML | truncate 70 }}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
{{- end -}}
|
8
plugin.json
Normal file
8
plugin.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"version": "1.2.0",
|
||||||
|
"title": "Postlist",
|
||||||
|
"description": "Shortcode for dynamically adding a list of posts",
|
||||||
|
"includes": [
|
||||||
|
"/postlist.css"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in a new issue