From 2aa09b4b974dd3c27e73d97487945592c90d61e5 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sat, 16 Aug 2025 09:54:29 +1000 Subject: [PATCH 1/5] Added title-matches attribute --- layouts/shortcodes/postlist.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/layouts/shortcodes/postlist.html b/layouts/shortcodes/postlist.html index b26e6e1..bba2156 100644 --- a/layouts/shortcodes/postlist.html +++ b/layouts/shortcodes/postlist.html @@ -5,6 +5,9 @@ {{- $pgr = (where $pgr "Params.categories" "intersect" (slice .)) -}} {{- end -}} {{- end -}} +{{- if (.Get "title-matches") -}} + {{- $pgr = (where $pgr "Params.title" "like" (.Get "title-matches") -}} +{{- end -}} {{- if (ne (.Get "order") "") -}} {{- $order := split (.Get "order") " " -}} From 16fd84b355245962259416680e90977b2567e13f Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sat, 16 Aug 2025 09:55:54 +1000 Subject: [PATCH 2/5] Fixed missing paren --- layouts/shortcodes/postlist.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/shortcodes/postlist.html b/layouts/shortcodes/postlist.html index bba2156..eef91b7 100644 --- a/layouts/shortcodes/postlist.html +++ b/layouts/shortcodes/postlist.html @@ -6,7 +6,7 @@ {{- end -}} {{- end -}} {{- if (.Get "title-matches") -}} - {{- $pgr = (where $pgr "Params.title" "like" (.Get "title-matches") -}} + {{- $pgr = (where $pgr "Params.title" "like" (.Get "title-matches")) -}} {{- end -}} {{- if (ne (.Get "order") "") -}} From 93bfec1212da154676979291a2827d8c1706063e Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sat, 16 Aug 2025 10:05:19 +1000 Subject: [PATCH 3/5] Updated version of Postlist to 1.3.0 --- plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.json b/plugin.json index f1dd227..e8d2824 100644 --- a/plugin.json +++ b/plugin.json @@ -1,5 +1,5 @@ { - "version": "1.2.0", + "version": "1.3.0", "title": "Postlist", "description": "Shortcode for dynamically adding a list of posts", "includes": [ From 84e0ff56ea3e14262ba8c097077ac872999f6190 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sat, 16 Aug 2025 10:37:09 +1000 Subject: [PATCH 4/5] Fixed issues when no parameters were sert - Fixed issue with postlist not showing anything where called without parameters - Switch alpha sort to ByTitle --- layouts/shortcodes/postlist.html | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/layouts/shortcodes/postlist.html b/layouts/shortcodes/postlist.html index eef91b7..afa9f53 100644 --- a/layouts/shortcodes/postlist.html +++ b/layouts/shortcodes/postlist.html @@ -1,18 +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 (.Get "title-matches") -}} - {{- $pgr = (where $pgr "Params.title" "like" (.Get "title-matches")) -}} + +{{- if (ne $parTitleMatches "") -}} + {{- $pgr = (where $pgr "Params.title" "like" $parTitleMatches) -}} {{- end -}} -{{- if (ne (.Get "order") "") -}} - {{- $order := split (.Get "order") " " -}} +{{- 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 -}} @@ -21,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 }} From 1f3a89a05a438f0c14251037bb7d054f92aaddfb Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sat, 16 Aug 2025 11:52:21 +1000 Subject: [PATCH 5/5] Bumped version number to 1.3.1 --- plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.json b/plugin.json index e8d2824..f88bf11 100644 --- a/plugin.json +++ b/plugin.json @@ -1,5 +1,5 @@ { - "version": "1.3.0", + "version": "1.3.1", "title": "Postlist", "description": "Shortcode for dynamically adding a list of posts", "includes": [