summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-04-15 22:21:22 +0200
committerDanilo M. <danix@danix.xyz>2026-04-15 22:21:22 +0200
commita8dbba5efbc8879db833b7a7b902b0a0f446e935 (patch)
tree4e0d35d089c47bb0af6606a75319d79e205ed1c5 /themes/danix-xyz-hacker
parentbdce585ecc814b148827d9fb2a5fa4b2afe546e7 (diff)
downloaddanixxyz-a8dbba5efbc8879db833b7a7b902b0a0f446e935.tar.gz
danixxyz-a8dbba5efbc8879db833b7a7b902b0a0f446e935.zip
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 <noreply@anthropic.com>
Diffstat (limited to 'themes/danix-xyz-hacker')
-rw-r--r--themes/danix-xyz-hacker/layouts/_default/list.html8
1 files changed, 8 insertions, 0 deletions
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 no unpinned posts found (because param is undefined), get all non-pinned pages -->
+ {{ if eq (len $unpinned) 0 }}
+ {{ $unpinned = where .Pages "Params.pinned" nil }}
+ {{ if eq (len $unpinned) 0 }}
+ {{ $unpinned = where .Pages "Params.pinned" "" }}
+ {{ end }}
+ {{ end }}
+
<!-- Pinned posts first -->
{{ range (sort $pinned "Date" "desc") }}
{{ partial "article-list-item.html" . }}