From f784149c9f2860f425ce6477cb568b4325a95d93 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 22 Jun 2026 18:12:39 -0700 Subject: [PATCH] fix(pagination): collapse long pager lists with ellipsis Apply the windowed pager already used in _default/list.html to the author taxonomy and podcast list templates. Shows the first/last two pages plus the current page and its neighbours, collapsing the gaps into a single "...", so long lists no longer overflow the viewport. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Q2NJsYE8nUKKHD25jXiHV1 --- .../layouts/podcast/list.html | 26 ++++++++++++------- .../layouts/taxonomy/author.html | 26 ++++++++++++------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/themes/powershell-community/layouts/podcast/list.html b/themes/powershell-community/layouts/podcast/list.html index 489375682..910c1145d 100644 --- a/themes/powershell-community/layouts/podcast/list.html +++ b/themes/powershell-community/layouts/podcast/list.html @@ -101,16 +101,24 @@

{{ end }} + {{ $currentPage := $paginator.PageNumber }} + {{ $totalPages := $paginator.TotalPages }} + {{ range $paginator.Pagers }} - {{ if eq . $paginator }} - - {{ .PageNumber }} - - {{ else }} - - {{ .PageNumber }} - + {{ $pageNumber := .PageNumber }} + {{ if or (le $pageNumber 2) (ge $pageNumber (sub $totalPages 1)) (and (ge $pageNumber (sub $currentPage 1)) (le $pageNumber (add $currentPage 1))) }} + {{ if eq . $paginator }} + + {{ .PageNumber }} + + {{ else }} + + {{ .PageNumber }} + + {{ end }} + {{ else if or (eq $pageNumber 3) (eq $pageNumber (sub $totalPages 2)) }} + ... {{ end }} {{ end }} diff --git a/themes/powershell-community/layouts/taxonomy/author.html b/themes/powershell-community/layouts/taxonomy/author.html index e73691099..4f0d3f3bb 100644 --- a/themes/powershell-community/layouts/taxonomy/author.html +++ b/themes/powershell-community/layouts/taxonomy/author.html @@ -168,16 +168,24 @@

{{ end }} + {{ $currentPage := $paginator.PageNumber }} + {{ $totalPages := $paginator.TotalPages }} + {{ range $paginator.Pagers }} - {{ if eq . $paginator }} - - {{ .PageNumber }} - - {{ else }} - - {{ .PageNumber }} - + {{ $pageNumber := .PageNumber }} + {{ if or (le $pageNumber 2) (ge $pageNumber (sub $totalPages 1)) (and (ge $pageNumber (sub $currentPage 1)) (le $pageNumber (add $currentPage 1))) }} + {{ if eq . $paginator }} + + {{ .PageNumber }} + + {{ else }} + + {{ .PageNumber }} + + {{ end }} + {{ else if or (eq $pageNumber 3) (eq $pageNumber (sub $totalPages 2)) }} + ... {{ end }} {{ end }}