From 6a8365050645084c33f444f26c5fc68ec807d7f5 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Sun, 11 Aug 2024 16:20:24 +0800 Subject: [PATCH] :sparkles: Feat: add post navigation config and remove params.Site.Params.navigationReverse Closes #480 --- hugo.toml | 9 +++++++-- layouts/partials/init/index.html | 2 +- layouts/partials/single/footer.html | 9 ++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/hugo.toml b/hugo.toml index 6451c7bf..2c62cea4 100644 --- a/hugo.toml +++ b/hugo.toml @@ -331,8 +331,6 @@ enableEmoji = true enablePWA = false # FixIt 0.2.14 | NEW whether to add external Icon for external links automatically externalIcon = false - # FixIt 0.3.0 | NEW whether to reverse the order of the navigation menu - navigationReverse = false # FixIt 0.3.0 | NEW whether to add site title to the title of every page # remember to set up your site title in `hugo.toml` (e.g. title = "title") withSiteTitle = true @@ -444,6 +442,13 @@ enableEmoji = true sticky = false showHome = false + # FixIt 0.3.10 | NEW Post navigation config + [params.navigation] + # whether to show the post navigation in section pages scope + inSection = false + # whether to reverse the next/previous post navigation order + reverse = false + # Footer config [params.footer] enable = true diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index 67c68846..ea2a9a49 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.10-24873c5e" -}} +{{- .Scratch.Set "version" "v0.3.10-c936e541" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} diff --git a/layouts/partials/single/footer.html b/layouts/partials/single/footer.html index 0bb42b37..f39489ec 100644 --- a/layouts/partials/single/footer.html +++ b/layouts/partials/single/footer.html @@ -98,11 +98,18 @@ + {{- $navigation := .Site.Params.navigation -}}
{{- $pages := .Scratch.Get "mainSectionPages" -}} {{- $prev := $pages.Prev . -}} {{- $next := $pages.Next . -}} - {{- if .Site.Params.navigationReverse -}} + {{- /* Show the post navigation in section pages */ -}} + {{- if $navigation.inSection -}} + {{- $prev = .PrevInSection -}} + {{- $next = .NextInSection -}} + {{- end -}} + {{- /* Reverse the next/previous post navigation order */ -}} + {{- if $navigation.reverse -}} {{- $prev = $pages.Next . -}} {{- $next = $pages.Prev . -}} {{- end -}}