feat: add optional pagination control for blog articles (#590)

This commit is contained in:
Xin 2025-02-26 23:13:43 +00:00 committed by GitHub
parent c2286c9dd1
commit 96b2f6145d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View File

@ -164,6 +164,9 @@ params:
sortBy: date
sortOrder: desc # or "asc"
article:
displayPagination: true
highlight:
copy:
enable: true

View File

@ -38,10 +38,12 @@
<div class="content">
{{ .Content }}
</div>
{{ partial "components/last-updated.html" . }}
{{ .Scratch.Set "reversePagination" true }}
{{ partial "components/pager.html" . }}
{{ partial "components/comments.html" . }}
{{- partial "components/last-updated.html" . -}}
{{- if (site.Params.blog.article.displayPagination | default true) -}}
{{- .Scratch.Set "reversePagination" true -}}
{{- partial "components/pager.html" . -}}
{{ end }}
{{- partial "components/comments.html" . -}}
</main>
</article>
</div>