refinements to navtype circles

This commit is contained in:
Gabriele Musco 2021-04-12 23:58:07 +02:00
parent a103d30a57
commit 53fc545728
No known key found for this signature in database
GPG Key ID: 8539FD3454380B83
1 changed files with 20 additions and 4 deletions

View File

@ -1,22 +1,38 @@
{{ if gt .Paginator.TotalPages 1 }} {{ if gt .Paginator.TotalPages 1 }}
{{ $navtype := .Site.Params.Navtype }}
<div id="pageNavigation" class=' <div id="pageNavigation" class='
{{ if eq .Site.Params.Navtype "circles" }} {{ if eq $navtype "circles" }}
nav-circles nav-circles
{{ end }} {{ end }}
'> '>
{{ if .Paginator.HasPrev }} {{ if .Paginator.HasPrev }}
<a href="{{ .Paginator.Prev.URL }}" title="Previous page">&lt;&lt;&lt;</a> <a href="{{ .Paginator.Prev.URL }}" title="Previous page">
{{ if eq $navtype "circles" }}
{{ else }}
&lt;&lt;&lt;
{{ end }}
</a>
{{ end }} {{ end }}
{{ $currentPage := .Paginator.PageNumber }} {{ $currentPage := .Paginator.PageNumber }}
{{ range .Paginator.Pagers }} {{ range .Paginator.Pagers }}
{{ if ne .PageNumber $currentPage }} {{ if ne .PageNumber $currentPage }}
<a href="{{ .URL }}">{{ .PageNumber }}</a> <a href="{{ .URL }}">{{ .PageNumber }}</a>
{{ else }} {{ else }}
<span>[{{ .PageNumber }}]</span> <span>
{{ if eq $navtype "circles" }}{{ .PageNumber }}
{{ else }}[{{ .PageNumber }}]{{ end }}
</span>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if .Paginator.HasNext }} {{ if .Paginator.HasNext }}
<a href="{{ .Paginator.Next.URL }}" title="Next page">&gt;&gt;&gt;</a> <a href="{{ .Paginator.Next.URL }}" title="Next page">
{{ if eq $navtype "circles" }}
{{ else }}
&gt;&gt;&gt;
{{ end }}
</a>
{{ end }} {{ end }}
</div> </div>
{{ end }} {{ end }}