From 9d9ecc4d00f4e1b6e121b02622188ee26d891657 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Sun, 25 Jan 2026 23:12:28 +0100 Subject: [PATCH] fix: error when no page is found (#1234) --- layouts/_partials/helper/paginator.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/layouts/_partials/helper/paginator.html b/layouts/_partials/helper/paginator.html index 55f6a66..f05dc96 100644 --- a/layouts/_partials/helper/paginator.html +++ b/layouts/_partials/helper/paginator.html @@ -1,10 +1,13 @@ -{{- $pages := "" -}} +{{- $pages := slice -}} +{{- $hasPages := false -}} {{- if .IsHome -}} {{ $pages = where .Site.RegularPages "Section" "in" .Site.Params.mainSections }} {{ $pages = where $pages "Params.hidden" "!=" true }} + {{- $hasPages = true -}} {{- else if eq .Kind "term" -}} {{ $pages = where .Pages "Params.hidden" "!=" true }} + {{- $hasPages = true -}} {{- else if or (eq .Kind "section") (eq .Kind "taxonomy") -}} {{ $subsections := .Sections }} {{ $pages = .Pages | complement $subsections }} @@ -14,9 +17,11 @@ {{/* See complete logic in list.html */}} {{- $pages = $subsections -}} {{- end -}} + + {{- $hasPages = true -}} {{- end -}} -{{- if $pages -}} +{{- if $hasPages -}} {{ $pages = .Paginate $pages }} {{- end -}}