fix: error when no page is found (#1234)

This commit is contained in:
Jimmy
2026-01-25 23:12:28 +01:00
committed by GitHub
parent 5f1ab2bc76
commit 9d9ecc4d00
+7 -2
View File
@@ -1,10 +1,13 @@
{{- $pages := "" -}} {{- $pages := slice -}}
{{- $hasPages := false -}}
{{- if .IsHome -}} {{- if .IsHome -}}
{{ $pages = where .Site.RegularPages "Section" "in" .Site.Params.mainSections }} {{ $pages = where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
{{ $pages = where $pages "Params.hidden" "!=" true }} {{ $pages = where $pages "Params.hidden" "!=" true }}
{{- $hasPages = true -}}
{{- else if eq .Kind "term" -}} {{- else if eq .Kind "term" -}}
{{ $pages = where .Pages "Params.hidden" "!=" true }} {{ $pages = where .Pages "Params.hidden" "!=" true }}
{{- $hasPages = true -}}
{{- else if or (eq .Kind "section") (eq .Kind "taxonomy") -}} {{- else if or (eq .Kind "section") (eq .Kind "taxonomy") -}}
{{ $subsections := .Sections }} {{ $subsections := .Sections }}
{{ $pages = .Pages | complement $subsections }} {{ $pages = .Pages | complement $subsections }}
@@ -14,9 +17,11 @@
{{/* See complete logic in list.html */}} {{/* See complete logic in list.html */}}
{{- $pages = $subsections -}} {{- $pages = $subsections -}}
{{- end -}} {{- end -}}
{{- $hasPages = true -}}
{{- end -}} {{- end -}}
{{- if $pages -}} {{- if $hasPages -}}
{{ $pages = .Paginate $pages }} {{ $pages = .Paginate $pages }}
{{- end -}} {{- end -}}