Feat: add post navigation config and remove params.Site.Params.navigationReverse

Closes #480
This commit is contained in:
Cell
2024-08-11 16:20:24 +08:00
parent 1c84791db9
commit 6a83650506
3 changed files with 16 additions and 4 deletions
+7 -2
View File
@@ -331,8 +331,6 @@ enableEmoji = true
enablePWA = false enablePWA = false
# FixIt 0.2.14 | NEW whether to add external Icon for external links automatically # FixIt 0.2.14 | NEW whether to add external Icon for external links automatically
externalIcon = false 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 # 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") # remember to set up your site title in `hugo.toml` (e.g. title = "title")
withSiteTitle = true withSiteTitle = true
@@ -444,6 +442,13 @@ enableEmoji = true
sticky = false sticky = false
showHome = 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 # Footer config
[params.footer] [params.footer]
enable = true enable = true
+1 -1
View File
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.10-24873c5e" -}} {{- .Scratch.Set "version" "v0.3.10-c936e541" -}}
{{- .Scratch.Set "this" dict -}} {{- .Scratch.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}} {{- partial "init/detection-env.html" . -}}
+8 -1
View File
@@ -98,11 +98,18 @@
</section> </section>
</div> </div>
{{- $navigation := .Site.Params.navigation -}}
<div class="post-nav"> <div class="post-nav">
{{- $pages := .Scratch.Get "mainSectionPages" -}} {{- $pages := .Scratch.Get "mainSectionPages" -}}
{{- $prev := $pages.Prev . -}} {{- $prev := $pages.Prev . -}}
{{- $next := $pages.Next . -}} {{- $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 . -}} {{- $prev = $pages.Next . -}}
{{- $next = $pages.Prev . -}} {{- $next = $pages.Prev . -}}
{{- end -}} {{- end -}}