From 6c22754f04da99741657a63c263c17ff9fad48a5 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Tue, 7 Jan 2025 17:04:11 -0500 Subject: [PATCH] Blog list layout refactoring (#2155) --- layouts/blog/list.html | 57 +++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/layouts/blog/list.html b/layouts/blog/list.html index 43f536ae9c..2dc8b18719 100644 --- a/layouts/blog/list.html +++ b/layouts/blog/list.html @@ -1,40 +1,41 @@ -{{ define "main" }} +{{ define "main" -}} + {{ if (and .Parent .Parent.IsHome) -}} {{ $.Scratch.Set "blog-pages" (where .Site.RegularPages "Section" .Section) -}} {{ else -}} {{$.Scratch.Set "blog-pages" .Pages -}} {{ end -}} +{{- if .Pages -}}
- {{ if .Pages -}} - {{ $pag := .Paginate (( $.Scratch.Get "blog-pages").GroupByDate "2006" ) -}} - {{ range $pag.PageGroups -}} -
{{ T "post_posts_in" }} {{ .Key }}
- + {{ $pager := .Paginate (( $.Scratch.Get "blog-pages").GroupByDate "2006" ) -}} + {{ range $pager.PageGroups -}} +
{{ T "post_posts_in" }} {{ .Key }}
+ + {{ end -}}
- {{ if .Pages -}} - {{ template "_internal/pagination.html" . -}} - {{ end -}} + {{ template "_internal/pagination.html" . -}}
+{{- end -}} {{ end -}}