49 lines
1.3 KiB
HTML
49 lines
1.3 KiB
HTML
|
{{ $pag := .Paginator }}
|
||
|
|
||
|
<div class="pagination">
|
||
|
<span>Pages:</span>
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a href="{{ $pag.First.URL }}">First</a>
|
||
|
</li>
|
||
|
{{- with $pag.HasPrev }}
|
||
|
{{- if ne $pag.Prev.PageNumber $pag.First.PageNumber }}
|
||
|
{{- $ppage := $pag.Prev }}
|
||
|
{{- with $ppage.HasPrev }}
|
||
|
{{- if ne $ppage.Prev.PageNumber $pag.First.PageNumber }}
|
||
|
<li>
|
||
|
<a href="{{ $ppage.Prev.URL }}">{{ sub $pag.PageNumber 2 }}</a>
|
||
|
</li>
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
<li>
|
||
|
<a href="{{ $ppage.URL }}">{{ sub $pag.PageNumber 1 }}</a>
|
||
|
</li>
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- if and (ne $pag.PageNumber $pag.First.PageNumber) (ne $pag.PageNumber $pag.Last.PageNumber) }}
|
||
|
<li class="selected">
|
||
|
<a href="{{ $pag.URL }}">{{ $pag.PageNumber }}</a>
|
||
|
</li>
|
||
|
{{- end }}
|
||
|
{{- with $pag.HasNext }}
|
||
|
{{- if ne $pag.Next.PageNumber $pag.Last.PageNumber }}
|
||
|
{{- $npage := $pag.Next }}
|
||
|
<li>
|
||
|
<a href="{{ $npage.URL }}">{{ add $pag.PageNumber 1 }}</a>
|
||
|
</li>
|
||
|
{{- with $npage.HasNext }}
|
||
|
{{- if ne $npage.Next.PageNumber $pag.Last.PageNumber }}
|
||
|
<li>
|
||
|
<a href="{{ $npage.Next.URL }}">{{ add $pag.PageNumber 2 }}</a>
|
||
|
</li>
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
<li>
|
||
|
<a href="{{ $pag.Last.URL }}">Last</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|