{{ $pag := $.Paginator }} {{ if gt $pag.TotalPages 1 }} <ul class="pagination"> {{ if gt $pag.TotalPages 5 }} {{ with $pag.First }} <li> <a href="{{ .URL }}" aria-label="First"><span aria-hidden="true">««</span></a> </li> {{ end }} {{ end }} <li {{ if not $pag.HasPrev }}class="disabled"{{ end }}> <a href="{{ if $pag.HasPrev }}{{ $pag.Prev.URL }}{{ end }}" aria-label="Previous"><span aria-hidden="true">«</span></a> </li> {{ range $pag.Pagers }} <li {{ if eq . $pag }}class="active"{{ end }}><a href="{{ .URL }}">{{ .PageNumber }}</a></li> {{ end }} <li {{ if not $pag.HasNext }}class="disabled"{{ end }}> <a href="{{ if $pag.HasNext }}{{ $pag.Next.URL }}{{ end }}" aria-label="Next"><span aria-hidden="true">»</span></a> </li> {{ if gt $pag.TotalPages 5 }} {{ with $pag.Last }} <li> <a href="{{ .URL }}" aria-label="Last"><span aria-hidden="true">»»</span></a> </li> {{ end }} {{ end }} </ul> {{ end }}