- 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 <redacted>
++++
+title = "Articles"
++++
+
My articles
{{ $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" . }}