🐛 Fix: fix regular page in post navigation

This commit is contained in:
Cell
2024-01-16 16:04:57 +08:00
parent dd4f422dba
commit b7dba0713e
8 changed files with 17 additions and 8 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
{{- define "content" -}}
{{- /* All Posts */ -}}
{{- $pages := where .Site.RegularPages "Type" "posts" -}}
{{- $pages := .Scratch.Get "mainSectionPages" -}}
<div class="page archive">
<div class="header">
+1 -1
View File
@@ -28,7 +28,7 @@
{{- /* Posts */ -}}
{{- if ne $posts.enable false | and .Site.RegularPages -}}
{{- /* Paginate */ -}}
{{- $pages := where .Site.RegularPages "Type" "posts" -}}
{{- $pages := .Scratch.Get "mainSectionPages" -}}
{{- if .Site.Params.page.hiddenFromHomePage -}}
{{- $pages = where $pages "Params.hiddenfromhomepage" false -}}
{{- else -}}
+1 -1
View File
@@ -1,6 +1,6 @@
# {{ .Site.Title }}
{{ $pages := where .Site.RegularPages "Type" "posts" -}}
{{ $pages := .Scratch.Get "mainSectionPages" -}}
{{- $pages = where $pages "Draft" "eq" false -}}
{{- T "section.archiveCounter" (len $pages) }}
{{ range $pages.GroupByPublishDate "2006" }}
+1 -1
View File
@@ -36,7 +36,7 @@
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}}
{{- range .Scratch.Get "mainSectionPages" | first (.Site.Params.home.rss | default 10) -}}
{{- $params := .Scratch.Get "params" -}}
{{- if $params.password | or $params.hiddenFromRss }}{{ continue }}{{ end -}}
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
+4
View File
@@ -10,3 +10,7 @@
{{- $homeRelPermalink = strings.TrimSuffix "archives/" $homeRelPermalink -}}
{{- $homeRelPermalink = strings.TrimSuffix "offline/" $homeRelPermalink -}}
{{- .Scratch.Set "homeRelPermalink" $homeRelPermalink -}}
{{- /* Set pages of main section */ -}}
{{- $pages := where .Site.RegularPages "Type" "posts" -}}
{{- .Scratch.Set "mainSectionPages" $pages -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.1" -}}
{{- .Scratch.Set "version" "v0.3.2-RC" -}}
{{- .Scratch.Set "params" (.Params | merge .Site.Params.page) -}}
{{- .Scratch.Set "this" dict -}}
+7 -2
View File
@@ -98,8 +98,13 @@
</div>
<div class="post-nav">
{{- $prev := cond .Site.Params.navigationReverse .Next .Prev -}}
{{- $next := cond .Site.Params.navigationReverse .Prev .Next -}}
{{- $pages := .Scratch.Get "mainSectionPages" -}}
{{- $prev := $pages.Prev . -}}
{{- $next := $pages.Next . -}}
{{- if .Site.Params.navigationReverse -}}
{{- $prev = $pages.Next . -}}
{{- $next = $pages.Prev . -}}
{{- end -}}
{{- 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" -}}
+1 -1
View File
@@ -3,7 +3,7 @@
{{- $params := .Scratch.Get "params" -}}
{{- if $params.related.enable | and (not $params.password) -}}
{{- $posts := where .Site.RegularPages "Type" "posts" -}}
{{- $posts := .Scratch.Get "mainSectionPages" -}}
{{- if .Site.Params.page.hiddenFromRelated -}}
{{- $posts = where $posts "Params.hiddenfromrelated" false -}}
{{- else -}}