Compare commits

..

5 commits

Author SHA1 Message Date
Leon Mika 1f3a89a05a Bumped version number to 1.3.1 2025-08-16 11:52:21 +10:00
Leon Mika 84e0ff56ea Fixed issues when no parameters were sert
- Fixed issue with postlist not showing anything where called without parameters
- Switch alpha sort to ByTitle
2025-08-16 11:48:16 +10:00
Leon Mika 93bfec1212 Updated version of Postlist to 1.3.0 2025-08-16 10:05:19 +10:00
Leon Mika 16fd84b355 Fixed missing paren 2025-08-16 09:56:00 +10:00
Leon Mika 2aa09b4b97 Added title-matches attribute 2025-08-16 09:54:29 +10:00
2 changed files with 20 additions and 9 deletions

View file

@ -1,15 +1,26 @@
{{- $parCategories := or (and .Params (.Get "categories")) "" -}}
{{- $parTitleMatches := or (and .Params (.Get "title-matches")) "" -}}
{{- $parOrder := or (and .Params (.Get "order")) "" -}}
{{- $parLimit := or (and .Params (.Get "limit")) "" -}}
{{- $parDisplay := or (and .Params (.Get "display")) "" -}}
{{- $pgr := where .Site.RegularPages "Section" "ne" "" -}}
{{- $pgr = where $pgr "Section" "not in" (slice "replies") -}}
{{- if (.Get "categories") -}}
{{- range (split (.Get "categories") ",") -}}
{{- if (ne $parCategories "") -}}
{{- range (split $parCategories ",") -}}
{{- $pgr = (where $pgr "Params.categories" "intersect" (slice .)) -}}
{{- end -}}
{{- end -}}
{{- if (ne (.Get "order") "") -}}
{{- $order := split (.Get "order") " " -}}
{{- if (ne $parTitleMatches "") -}}
{{- $pgr = (where $pgr "Params.title" "like" $parTitleMatches) -}}
{{- end -}}
{{- if (ne $parOrder "") -}}
{{- $order := split $parOrder " " -}}
{{- if (eq (index $order 0) "alpha" ) -}}
{{- $pgr = $pgr.ByLinkTitle -}}
{{- $pgr = $pgr.ByTitle -}}
{{- else if (eq (index $order 0) "date" ) -}}
{{- $pgr = $pgr.ByDate -}}
{{- end -}}
@ -18,11 +29,11 @@
{{- end -}}
{{- end -}}
{{- if (ne (.Get "limit") "") -}}
{{- $pgr = $pgr.Limit (int (.Get "limit")) -}}
{{- if (ne $parLimit "") -}}
{{- $pgr = $pgr.Limit (int $parLimit) -}}
{{- end -}}
{{- if (eq (.Get "display") "content") -}}
{{- if (eq $parDisplay "content") -}}
{{ if templates.Exists "partials/_postlist/post-content-before.html" }}
{{ partial "_postlist/post-content-before.html" $pgr }}
{{ end }}

View file

@ -1,5 +1,5 @@
{
"version": "1.2.0",
"version": "1.3.1",
"title": "Postlist",
"description": "Shortcode for dynamically adding a list of posts",
"includes": [