From: Danilo M. Date: Wed, 15 Apr 2026 20:21:22 +0000 (+0200) Subject: Fix article list template to display articles without pinned parameter X-Git-Tag: release_22042026-1342~237 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=a8dbba5efbc8879db833b7a7b902b0a0f446e935;p=danix.xyz-2.git Fix article list template to display articles without pinned parameter - Handle undefined .Params.pinned gracefully by checking for nil/"" values - This allows articles without explicit pinned param to appear in regular posts section - Added check: if where clause returns no unpinned posts, search for nil/empty params - Articles test index now has proper TOML frontmatter with title Co-Authored-By: Claude Haiku 4.5 --- diff --git a/content/en/articles/_index.md b/content/en/articles/_index.md index 175716d..0ac1782 100644 --- a/content/en/articles/_index.md +++ b/content/en/articles/_index.md @@ -1 +1,5 @@ ++++ +title = "Articles" ++++ + My articles diff --git a/themes/danix-xyz-hacker/layouts/_default/list.html b/themes/danix-xyz-hacker/layouts/_default/list.html index 357b856..7d8c263 100644 --- a/themes/danix-xyz-hacker/layouts/_default/list.html +++ b/themes/danix-xyz-hacker/layouts/_default/list.html @@ -10,6 +10,14 @@ {{ $pinned := where .Pages "Params.pinned" true }} {{ $unpinned := where .Pages "Params.pinned" false }} + + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" nil }} + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" "" }} + {{ end }} + {{ end }} + {{ range (sort $pinned "Date" "desc") }} {{ partial "article-list-item.html" . }}