From 96b2f6145dfaa32879eb1d0557bc3763a5aa180e Mon Sep 17 00:00:00 2001 From: Xin Date: Wed, 26 Feb 2025 23:13:43 +0000 Subject: [PATCH] feat: add optional pagination control for blog articles (#590) --- exampleSite/hugo.yaml | 3 +++ layouts/blog/single.html | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index 4acc403..c621f92 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -163,6 +163,9 @@ params: # date | lastmod | publishDate | title | weight sortBy: date sortOrder: desc # or "asc" + + article: + displayPagination: true highlight: copy: diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 75fa392..e1567b0 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -38,11 +38,13 @@
{{ .Content }}
- {{ 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" . -}} -{{ end }} \ No newline at end of file +{{ end }}