36 lines
1.2 KiB
HTML
36 lines
1.2 KiB
HTML
{{ $pag := $.Paginator }}
|
|
{{ if gt $pag.TotalPages 1 -}}
|
|
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
|
|
{{ with $pag.First -}}
|
|
<ul class="pagination-list">
|
|
{{ end -}}
|
|
{{- $ellipsed := false -}}
|
|
{{- $shouldEllipse := false -}}
|
|
{{- range $pag.Pagers -}}
|
|
{{- $right := sub .TotalPages .PageNumber -}}
|
|
{{- $showNumber := or (le .PageNumber 1) (eq $right 0) -}}
|
|
{{- $showNumber := or $showNumber (le .TotalPages 5) -}}{{/* Issue #7523 */}}
|
|
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 3)) (lt .PageNumber (add $pag.PageNumber 3))) -}}
|
|
{{- if $showNumber -}}
|
|
{{- $ellipsed = false -}}
|
|
{{- $shouldEllipse = false -}}
|
|
{{- else -}}
|
|
{{- $shouldEllipse = not $ellipsed -}}
|
|
{{- $ellipsed = true -}}
|
|
{{- end -}}
|
|
{{- if $showNumber }}
|
|
<li>
|
|
<a class="pagination-link{{ if eq . $pag }} is-current{{ end }}" href="{{ .URL }}" aria-label="Page {{ .PageNumber }}">{{ .PageNumber }}</a>
|
|
</li>
|
|
{{- else if $shouldEllipse }}
|
|
<li>
|
|
<span class="pagination-ellipsis">…</span>
|
|
</li>
|
|
{{- end -}}
|
|
{{- end }}
|
|
{{- with $pag.Last }}
|
|
{{- end }}
|
|
</ul>
|
|
</nav>
|
|
{{ end }}
|