diff options
Diffstat (limited to 'themes')
-rw-r--r-- | themes/default/layouts/partials/pagination.html | 116 |
1 files changed, 55 insertions, 61 deletions
diff --git a/themes/default/layouts/partials/pagination.html b/themes/default/layouts/partials/pagination.html index 4c2d97f..31bebeb 100644 --- a/themes/default/layouts/partials/pagination.html +++ b/themes/default/layouts/partials/pagination.html @@ -1,73 +1,67 @@ {{- with .Paginator -}} + + {{- $first := "Newest" -}} + {{- $prev := "Newer" -}} + {{- $next := "Older" -}} + {{- $last := "Oldest" -}} + {{- $invisible := "data-invisible" -}} + + {{- $firstData := $invisible -}} + {{- $firstHref := "" -}} + {{- $firstTitle := $first -}} + + {{- if and .HasPrev .First -}} + {{- $firstData = "" -}} + {{- $firstHref = .First.URL -}} + {{- end -}} + + {{- $prevData := $invisible -}} + {{- $prevHref := "" -}} + {{- $prevRel := "prev" -}} + {{- $prevTitle := $prev -}} + + {{- with .Prev -}} + {{- $prevData = "" -}} + {{- $prevHref = .URL -}} + {{- end -}} + + {{- $nextData := $invisible -}} + {{- $nextHref := "" -}} + {{- $nextRel := "next" -}} + {{- $nextTitle := $next -}} + + {{- if .Next -}} + {{- $nextData = "" -}} + {{- $nextHref = .Next.URL -}} + {{- end -}} + + {{- $lastData := $invisible -}} + {{- $lastHref := "" -}} + {{- $lastTitle := $last -}} + + {{- if and .HasNext .Last -}} + {{- $lastData = "" -}} + {{- $lastHref = .Last.URL -}} + {{- end -}} + <paginator-navigation{{ if eq .TotalPages 1 }} hidden {{ end }}> - {{ if and .HasPrev .First }} - <a - href="{{ .First.URL }}" - title="First" - > - First + + <a {{ $firstData | safeHTMLAttr }} href="{{ $firstHref }}" title="{{ $firstTitle }}" > + {{ $firstTitle }} </a> - {{ else }} - <button - data-invisible - title="Disabled" - > - First - </button> - {{- end -}} - {{ with .Prev }} - <a - rel="prev" - title="Back" - href="{{ .URL }}" - > + <a rel="{{ $prevRel }}" {{ $prevData | safeHTMLAttr }} href="{{ $prevHref }}" title="{{ $prevTitle }}"> {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-left.svg")) }} - Back + {{ $prevTitle }} </a> - {{ else }} - <button - data-invisible - title="Disabled" - > - {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-left.svg")) }} - Back - </button> - {{- end -}} - {{ if .Next }} - <a - rel="next" - title="Next" - href="{{ .Next.URL }}" - > - Next + <a rel="{{ $nextRel }}" {{ $nextData | safeHTMLAttr }} href="{{ $nextHref }}" title="{{ $nextTitle }}"> + {{ $nextTitle }} {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-right.svg")) }} </a> - {{ else }} - <button - data-invisible - title="Disabled" - > - Next - {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-right.svg")) }} - </button> - {{- end -}} - {{ if and .HasNext .Last }} - <a - href="{{ .Last.URL }}" - title="Last" - > - Last + <a {{ $lastData | safeHTMLAttr }} href="{{ $lastHref }}" title="{{ $lastTitle }}" > + {{ $lastTitle }} </a> - {{ else }} - <button - data-invisible - title="Disabled" - > - Last - </button> - {{- end -}} </paginator-navigation> -{{ end }} +{{- end -}} |