Feat: add params.navigationReverse to reverse the order of the navigation menu

This commit is contained in:
Cell
2023-12-26 14:47:07 +08:00
parent df3aaa7ea3
commit 68f4d5fb80
5 changed files with 15 additions and 7 deletions
+1 -1
Submodule docs updated: 4c004b1f6b...ead0f88b22
+2
View File
@@ -106,6 +106,8 @@ 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.2.14 | NEW FixIt will, by default, inject a theme meta tag in the HTML head on the home page only.
# You can turn it off, but we would really appreciate if you dont, as this is a good way to watch FixIt's popularity on the rise.
disableThemeInject = false
+4 -2
View File
@@ -5,6 +5,8 @@
{{- $collectionTerms := .GetTerms "collections" -}}
{{- range $collectionTerms -}}
{{- $pages := .Pages -}}
{{- $prev := cond $.Site.Params.navigationReverse ($pages.Next $) ($pages.Prev $) -}}
{{- $next := cond $.Site.Params.navigationReverse ($pages.Prev $) ($pages.Next $) -}}
{{- $open := eq (index $collectionTerms 0) . -}}
{{- $currentKey := 0 -}}
@@ -30,7 +32,7 @@
{{- end -}}
</ul>
<div class="collection-nav-simple">
{{- with $pages.Prev $ -}}
{{- with $prev -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ .LinkTitle }}">
{{- dict "Class" "fa-solid fa-angle-left fa-fw" | partial "plugin/icon.html" -}}
</a>
@@ -38,7 +40,7 @@
{{- dict "Class" "fa-solid fa-angle-left fa-fw collection-nav-item text-secondary" | partial "plugin/icon.html" -}}
{{- end -}}
<span class="text-secondary">{{ sub $pages.Len $currentKey }}/{{ $pages.Len }}</span>
{{- with $pages.Next $ -}}
{{- with $next -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ .LinkTitle }}">
{{- dict "Class" "fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}
</a>
+4 -2
View File
@@ -15,13 +15,15 @@
{{ dict "Collections" $termLink | T "single.includedIn.collections" | safeHTML }} {{ .Pages.Len }}
</div>
<div class="collection-nav">
{{- with .Pages.Prev $ -}}
{{- $prev := cond $.Site.Params.navigationReverse (.Pages.Next $) (.Pages.Prev $) -}}
{{- $next := cond $.Site.Params.navigationReverse (.Pages.Prev $) (.Pages.Next $) -}}
{{- with $prev -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ .LinkTitle }}">
{{- dict "Class" "fa-solid fa-angle-left fa-fw" | partial "plugin/icon.html" -}}
<span>{{- .LinkTitle -}}</span>
</a>
{{- end -}}
{{- with .Pages.Next $ -}}
{{- with $next -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ .LinkTitle }}">
<span>{{- .LinkTitle -}}</span>
{{- dict "Class" "fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}
+4 -2
View File
@@ -94,13 +94,15 @@
</div>
<div class="post-nav">
{{- with .Prev -}}
{{- $prev := cond .Site.Params.navigationReverse .Next .Prev -}}
{{- $next := cond .Site.Params.navigationReverse .Prev .Next -}}
{{- with $prev -}}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="prev" title="{{ .LinkTitle }}">
{{- dict "Class" "fa-solid fa-angle-left fa-fw" | partial "plugin/icon.html" -}}
{{- .LinkTitle -}}
</a>
{{- end -}}
{{ with .Next }}
{{ with $next }}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="next" title="{{ .LinkTitle }}">
{{- .LinkTitle -}}
{{- dict "Class" "fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}