mirror of
https://github.com/lmika/postlist-for-micro.blog.git
synced 2025-08-02 15:56:08 +00:00
Compare commits
No commits in common. "main" and "v0.1.1" have entirely different histories.
35
.forgejo/workflows/deploy.yaml
Normal file
35
.forgejo/workflows/deploy.yaml
Normal file
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
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
1
.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
.DS_Store
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2025 Leon Mika
|
||||
Copyright (c) 2025 lmika
|
||||
|
||||
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,15 +1,3 @@
|
|||
# Postlist for Micro.blog
|
||||
# postlist-for-micro.blog
|
||||
|
||||
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.
|
||||
A shortcode for post-list
|
|
@ -5,66 +5,17 @@
|
|||
{{- $pgr = (where $pgr "Params.categories" "intersect" (slice .)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- 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 -}}
|
||||
{{- if (eq (.Get "order") "link-title" ) -}}
|
||||
{{- $pgr = $pgr.ByLinkTitle -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (ne (.Get "limit") "") -}}
|
||||
{{- $pgr = $pgr.Limit (int (.Get "limit")) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- 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 }}
|
||||
<ul class="postlist">
|
||||
{{ range $pgr }}
|
||||
{{- if (ne .LinkTitle "") -}}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- else if (ne .Summary "") -}}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Summary | safeHTML | truncate 70 }}</a></li>
|
||||
{{- else -}}
|
||||
<ul class="postlist">
|
||||
{{ range $pgr }}
|
||||
{{- if (ne .LinkTitle "") -}}
|
||||
<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 -}}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Content | safeHTML | truncate 70 }}</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.2.0",
|
||||
"version": "0.2.0",
|
||||
"title": "Postlist",
|
||||
"description": "Shortcode for dynamically adding a list of posts",
|
||||
"includes": [
|
||||
|
|
Loading…
Reference in a new issue