From 7e56f0578adbacaa9fb9876ca1c606b313014fb1 Mon Sep 17 00:00:00 2001 From: ghac101 <7947004+ghac101@users.noreply.github.com> Date: Sat, 24 Jan 2026 13:42:49 +0100 Subject: [PATCH] feat(pagination): add option to disable prev/next navigation * Feature: disable next/previous pagination buttons site-wide * Moved the displayPagination to the layout level and adjusted the documentation. * fix: improve pagination docs and layout whitespace - Fix indentation in docs layout templates - Add pagination documentation for all languages (fa, ja, zh-cn) - Simplify documentation to be more succinct --------- Co-authored-by: Xin --- docs/content/docs/guide/configuration.fa.md | 13 +++++++++++++ docs/content/docs/guide/configuration.ja.md | 13 +++++++++++++ docs/content/docs/guide/configuration.md | 13 +++++++++++++ docs/content/docs/guide/configuration.zh-cn.md | 13 +++++++++++++ layouts/docs/list.html | 4 +++- layouts/docs/single.html | 4 +++- 6 files changed, 58 insertions(+), 2 deletions(-) diff --git a/docs/content/docs/guide/configuration.fa.md b/docs/content/docs/guide/configuration.fa.md index f8ca0e2..984ffe8 100644 --- a/docs/content/docs/guide/configuration.fa.md +++ b/docs/content/docs/guide/configuration.fa.md @@ -121,6 +121,19 @@ params: height: 20 ``` +### صفحه‌بندی + +برای غیرفعال کردن ناوبری قبلی/بعدی در پایین صفحات مستندات یا مقالات وبلاگ: + +```yaml {filename="hugo.yaml"} +params: + page: + displayPagination: false # برای صفحات مستندات + blog: + article: + displayPagination: false # برای مقالات وبلاگ +``` + ## نوار کناری ### نوار کناری اصلی diff --git a/docs/content/docs/guide/configuration.ja.md b/docs/content/docs/guide/configuration.ja.md index 13288f5..724b00a 100644 --- a/docs/content/docs/guide/configuration.ja.md +++ b/docs/content/docs/guide/configuration.ja.md @@ -121,6 +121,19 @@ params: height: 20 ``` +### ページネーション + +ドキュメントページやブログ記事の下部にある前へ/次へナビゲーションを無効にするには: + +```yaml {filename="hugo.yaml"} +params: + page: + displayPagination: false # ドキュメントページ用 + blog: + article: + displayPagination: false # ブログ記事用 +``` + ## サイドバー ### メインサイドバー diff --git a/docs/content/docs/guide/configuration.md b/docs/content/docs/guide/configuration.md index 6127262..dc7b699 100644 --- a/docs/content/docs/guide/configuration.md +++ b/docs/content/docs/guide/configuration.md @@ -128,6 +128,19 @@ params: height: 20 ``` +### Pagination + +To disable the previous/next navigation at the bottom of docs pages or blog articles: + +```yaml {filename="hugo.yaml"} +params: + page: + displayPagination: false # for docs pages + blog: + article: + displayPagination: false # for blog articles +``` + ## Sidebar ### Main Sidebar diff --git a/docs/content/docs/guide/configuration.zh-cn.md b/docs/content/docs/guide/configuration.zh-cn.md index 5017f8e..d0b6595 100644 --- a/docs/content/docs/guide/configuration.zh-cn.md +++ b/docs/content/docs/guide/configuration.zh-cn.md @@ -121,6 +121,19 @@ params: height: 20 ``` +### 分页导航 + +禁用文档页面或博客文章底部的上一篇/下一篇导航: + +```yaml {filename="hugo.yaml"} +params: + page: + displayPagination: false # 文档页面 + blog: + article: + displayPagination: false # 博客文章 +``` + ## 侧边栏 ### 主侧边栏 diff --git a/layouts/docs/list.html b/layouts/docs/list.html index 2eeb2d0..3d9cba9 100644 --- a/layouts/docs/list.html +++ b/layouts/docs/list.html @@ -15,7 +15,9 @@ {{ .Content }} {{ partial "components/last-updated.html" . }} - {{ partial "components/pager.html" . }} + {{- if (site.Params.page.displayPagination | default true) -}} + {{- partial "components/pager.html" . -}} + {{- end -}} {{ partial "components/comments.html" . }} diff --git a/layouts/docs/single.html b/layouts/docs/single.html index e7816a5..726e898 100644 --- a/layouts/docs/single.html +++ b/layouts/docs/single.html @@ -15,7 +15,9 @@ {{ .Content }} {{ partial "components/last-updated.html" . }} - {{ partial "components/pager.html" . }} + {{- if (site.Params.page.displayPagination | default true) -}} + {{- partial "components/pager.html" . -}} + {{- end -}} {{ partial "components/comments.html" . }}