summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Johnson <>2026-09-18 00:00:00 +0000
committerNicholas Johnson <>2026-09-19 16:06:44 -0400
commitfde870a4c5e9692b15495c3de8228a45dbd5d4c960d01d32b87641a7e5465c99 (patch)
tree71ac729c51c0823e6f215e4bd410bb6148067b82723283c4af7f9bc6aae511a4
parente1bcf44b88116494b3f720570d2bf822c5f4c82ecef13954df9645abed963bcc (diff)
downloadhugo-theme-journal-fde870a4c5e9692b15495c3de8228a45dbd5d4c960d01d32b87641a7e5465c99.tar.gz
hugo-theme-journal-fde870a4c5e9692b15495c3de8228a45dbd5d4c960d01d32b87641a7e5465c99.zip
Fix empty entry heading on sites without journal entries
The "Journal Entries" heading was guarded by .Site.RegularPages while the list below it was filtered to the "entry" section. A site with pages but no entries rendered the heading with nothing under it. Guard on the filtered collection instead. This also drops the .ByTitle sort, which was immediately discarded by the .ByPublishDate.Reverse that followed it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
-rw-r--r--layouts/home.gmi4
-rw-r--r--layouts/home.html4
2 files changed, 4 insertions, 4 deletions
diff --git a/layouts/home.gmi b/layouts/home.gmi
index 4ce3bf1..3668e45 100644
--- a/layouts/home.gmi
+++ b/layouts/home.gmi
@@ -13,11 +13,11 @@
{{ end -}}
-{{ if .Site.RegularPages }}
+{{ with (where .Site.RegularPages "Section" "entry").ByPublishDate.Reverse }}
## {{ i18n "journalEntries" -}}
-{{ range (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse }}
+{{ range . }}
{{ partial "metadata.gmi" . -}}
{{ end -}}
diff --git a/layouts/home.html b/layouts/home.html
index cdf2d01..3056518 100644
--- a/layouts/home.html
+++ b/layouts/home.html
@@ -12,9 +12,9 @@
</ul>
</nav>
{{ end -}}
- {{ if .Site.RegularPages -}}
+ {{ with (where .Site.RegularPages "Section" "entry").ByPublishDate.Reverse -}}
<h2>{{ i18n "journalEntries" }}</h2>
- {{ range (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse -}}
+ {{ range . -}}
{{ partial "metadata.html" . }}
{{ end -}}
{{ end -}}