{{- if .Paginator.HasPrev }} ← Previous {{- end }} {{- with .Paginator }} {{- $currentPage := .PageNumber }} {{- $totalPages := .TotalPages }} {{- if gt $totalPages 1 }}
    {{- range .Pagers }} {{- $isFirst := eq .PageNumber 1 }} {{- $isLast := eq .PageNumber $totalPages }} {{- $inWindow := and (ge .PageNumber (sub $currentPage 2)) (le .PageNumber (add $currentPage 2)) }} {{- $showPrevEllipsis := and (gt $currentPage 4) (eq .PageNumber 2) }} {{- $showNextEllipsis := and (lt $currentPage (sub $totalPages 3)) (eq .PageNumber (sub $totalPages 1)) }} {{- if or $showPrevEllipsis $showNextEllipsis }}
  1. …
  2. {{- else if or $isFirst $isLast $inWindow }}
  3. {{ .PageNumber }}
  4. {{- end }} {{- end }}
{{- end }} {{- end }} {{- if .Paginator.HasNext }} Next → {{- end }}