refactor: centralize pagination logic (#1227)

* refactor: centralize pagination logic into a new helper partial used for page titles and index display

* fix: list.html does not exclude hidden pages

* refactor: Simplify title generation logic
This commit is contained in:
Jimmy
2026-01-25 17:54:13 +01:00
committed by GitHub
parent 12daa8c9fc
commit 9add062300
4 changed files with 49 additions and 42 deletions
+2 -4
View File
@@ -1,10 +1,8 @@
{{ define "main" }}
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $filtered := where $pages "Params.hidden" "!=" true }}
{{ $pag := .Paginate ($filtered) }}
{{- $paginator := partial "helper/paginator.html" . -}}
<section class="article-list">
{{ range $index, $element := $pag.Pages }}
{{ range $index, $element := $paginator.Pages }}
{{ partial "article-list/default" . }}
{{ end }}
</section>