Skip to content

Commit f784149

Browse files
HeyItsGilbertclaude
andcommitted
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2NJsYE8nUKKHD25jXiHV1
1 parent 619884c commit f784149

2 files changed

Lines changed: 34 additions & 18 deletions

File tree

themes/powershell-community/layouts/podcast/list.html

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,24 @@ <h2 class="text-xl lg:text-2xl font-bold text-gray-900 mb-3">
101101
</a>
102102
{{ end }}
103103

104+
{{ $currentPage := $paginator.PageNumber }}
105+
{{ $totalPages := $paginator.TotalPages }}
106+
104107
{{ range $paginator.Pagers }}
105-
{{ if eq . $paginator }}
106-
<span class="px-3 py-2 bg-purple-600 text-white rounded-lg font-medium">
107-
{{ .PageNumber }}
108-
</span>
109-
{{ else }}
110-
<a href="{{ .URL }}"
111-
class="px-3 py-2 text-purple-600 hover:bg-purple-50 rounded-lg transition-colors duration-200">
112-
{{ .PageNumber }}
113-
</a>
108+
{{ $pageNumber := .PageNumber }}
109+
{{ if or (le $pageNumber 2) (ge $pageNumber (sub $totalPages 1)) (and (ge $pageNumber (sub $currentPage 1)) (le $pageNumber (add $currentPage 1))) }}
110+
{{ if eq . $paginator }}
111+
<span class="px-3 py-2 bg-purple-600 text-white rounded-lg font-medium">
112+
{{ .PageNumber }}
113+
</span>
114+
{{ else }}
115+
<a href="{{ .URL }}"
116+
class="px-3 py-2 text-purple-600 hover:bg-purple-50 rounded-lg transition-colors duration-200">
117+
{{ .PageNumber }}
118+
</a>
119+
{{ end }}
120+
{{ else if or (eq $pageNumber 3) (eq $pageNumber (sub $totalPages 2)) }}
121+
<span class="px-2 py-2 text-gray-400">...</span>
114122
{{ end }}
115123
{{ end }}
116124

themes/powershell-community/layouts/taxonomy/author.html

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,24 @@ <h2 class="text-xl lg:text-2xl font-bold text-gray-900 mb-3">
168168
</a>
169169
{{ end }}
170170

171+
{{ $currentPage := $paginator.PageNumber }}
172+
{{ $totalPages := $paginator.TotalPages }}
173+
171174
{{ range $paginator.Pagers }}
172-
{{ if eq . $paginator }}
173-
<span class="px-3 py-2 bg-blue-600 text-white rounded-lg font-medium">
174-
{{ .PageNumber }}
175-
</span>
176-
{{ else }}
177-
<a href="{{ .URL }}"
178-
class="px-3 py-2 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors duration-200">
179-
{{ .PageNumber }}
180-
</a>
175+
{{ $pageNumber := .PageNumber }}
176+
{{ if or (le $pageNumber 2) (ge $pageNumber (sub $totalPages 1)) (and (ge $pageNumber (sub $currentPage 1)) (le $pageNumber (add $currentPage 1))) }}
177+
{{ if eq . $paginator }}
178+
<span class="px-3 py-2 bg-blue-600 text-white rounded-lg font-medium">
179+
{{ .PageNumber }}
180+
</span>
181+
{{ else }}
182+
<a href="{{ .URL }}"
183+
class="px-3 py-2 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors duration-200">
184+
{{ .PageNumber }}
185+
</a>
186+
{{ end }}
187+
{{ else if or (eq $pageNumber 3) (eq $pageNumber (sub $totalPages 2)) }}
188+
<span class="px-2 py-2 text-gray-400">...</span>
181189
{{ end }}
182190
{{ end }}
183191

0 commit comments

Comments
 (0)