diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-05 10:27:36 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-05 10:27:36 +0200 |
| commit | 126d0f839fd66bd0b0d7c56931dc2a6f2f6886d3 (patch) | |
| tree | 9dfc11f59176af4383b247b98c89a86df3c8855f /layouts | |
| parent | 097a22c01992ef76f5885d544fa5e4997b719a85 (diff) | |
| download | danixxyz-theme-126d0f839fd66bd0b0d7c56931dc2a6f2f6886d3.tar.gz danixxyz-theme-126d0f839fd66bd0b0d7c56931dc2a6f2f6886d3.zip | |
fix: use articles section to properly detect and display articles
Changed home.html to fetch articles from the /articles section directly instead of filtering by Type. This properly handles existing articles that may use different type field formats.
Also increased articles shown from 3 to 6, sorted by date descending (newest first).
Supports both old articles with custom 'type' fields and new articles with the tech/life/quote/link/photo system.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/home.html | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/layouts/home.html b/layouts/home.html index 4d8587a..cffb6bc 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -5,9 +5,14 @@ <div class="feed-label">Latest</div> <div class="feed-grid"> - {{ range site.RegularPages }} - {{ if eq .Type "articles" }} - {{ $data := dict "title" .Title "type" .Params.type "description" .Summary "date" .Date "url" .RelPermalink "image" .Params.image "featured" .Params.featured }} + {{ $articlesSection := .Site.GetPage "/articles" }} + {{ if $articlesSection }} + {{ $articles := $articlesSection.Pages }} + {{ $articles := sort $articles "Date" "desc" }} + {{ range first 6 $articles }} + {{ $type := .Params.type }} + {{ if not $type }}{{ $type = "article" }}{{ end }} + {{ $data := dict "title" .Title "type" $type "description" .Summary "date" .Date "url" .RelPermalink "image" .Params.image "featured" .Params.featured }} {{ partial "post-card.html" $data }} {{ end }} {{ end }} |
