Files
FixIt/layouts/_partials/base/paginator.html
T
Cell 5322a15ceb docs(layouts): add header comments to undocumented partials
Add `{{/* ... */}}` header comments to 25 partials that had no documentation,
enabling `pnpm gen:docs` to generate their reference docs. Also fix
base/head/index.html leading blank line that prevented parser matching.

Groups covered: base/, feed/, function/, home/, init/, plugin/, single/, store/, (root).
2026-07-23 12:56:40 +08:00

36 lines
1.4 KiB
HTML

{{- /*
Pagination component with ellipsis.
Renders a paginated page list with ellipsis for large page counts.
Shows page numbers near the current page and ellipsis markers for distant ranges.
*/ -}}
{{- if gt .Paginator.TotalPages 1 -}}
<ul class="pagination">
{{- .Site.Store.Set "paginator.ellipsed" false -}}
{{- range $.Paginator.Pagers -}}
{{- $right := sub .TotalPages .PageNumber -}}
{{- $showNumber := or (le .PageNumber 1) (eq $right 0) -}}
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $.Paginator.PageNumber 3)) (lt .PageNumber (add $.Paginator.PageNumber 3))) -}}
{{- if $showNumber -}}
{{- $.Site.Store.Set "paginator.ellipsed" false -}}
{{- $.Site.Store.Set "paginator.shouldEllipse" false -}}
{{- else -}}
{{- $.Site.Store.Set "paginator.shouldEllipse" (not ($.Site.Store.Get "paginator.ellipsed") ) -}}
{{- $.Site.Store.Set "paginator.ellipsed" true -}}
{{- end -}}
{{- if $showNumber -}}
<li class="page-item{{ if eq . $.Paginator }} active{{ end }}">
<span class="page-link">
<a href="{{ .URL }}">{{ .PageNumber }}</a>
</span>
</li>
{{- else if ($.Site.Store.Get "paginator.shouldEllipse") -}}
<li class="page-item">
<span class="page-link" aria-hidden="true">&hellip;</span>
</li>
{{- end -}}
{{- end -}}
</ul>
{{- end -}}