diff options
Diffstat (limited to 'themes/default/layouts/partials/pagination.html')
-rw-r--r-- | themes/default/layouts/partials/pagination.html | 117 |
1 files changed, 46 insertions, 71 deletions
diff --git a/themes/default/layouts/partials/pagination.html b/themes/default/layouts/partials/pagination.html index d9360c4..e64bfcf 100644 --- a/themes/default/layouts/partials/pagination.html +++ b/themes/default/layouts/partials/pagination.html @@ -1,75 +1,50 @@ {{- with .Paginator -}} - <paginator-navigation{{ if eq .TotalPages 1 }} hidden {{ end }}> - {{ if and .HasPrev .First }} - <a - href="{{ .First.URL }}" - aria-label="First" - title="First" - role="button"> - First - </a> - {{ else }} - <button - data-invisible - title="Disabled" - aria-label="First"> - First - </button> - {{- end -}} + {{- $firstTitle := "hidden" -}} + {{- $prevTitle := "hidden" -}} + {{- $nextTitle := "hidden" -}} + {{- $lastTitle := "hidden" -}} + {{- $firstHref := "/" -}} + {{- $prevHref := "/" -}} + {{- $nextHref := "/" -}} + {{- $lastHref := "/" -}} - {{ with .Prev }} - <a - href="{{ .URL }}" - aria-label="Back" - title="Back" - role="button"> - {{ safeHTML (readFile (print (partial "function-paths-static.html") "/icons/feather/arrow-left.svg")) }} - Back - </a> - {{ else }} - <button - data-invisible - title="Disabled" - aria-label="Back"> - {{ safeHTML (readFile (print (partial "function-paths-static.html") "/icons/feather/arrow-left.svg")) }} - Back - </button> - {{- end -}} + {{- if and .HasPrev .First -}} + {{- $firstHref = .First.URL | absURL -}} + {{- $firstTitle = "Newest" -}} + {{- end -}} - {{ if .Next }} - <a - href="{{ .Next.URL }}" - aria-label="Next" - title="Next" - role="button"> - Next - {{ safeHTML (readFile (print (partial "function-paths-static.html") "/icons/feather/arrow-right.svg")) }} - </a> - {{ else }} - <button - data-invisible - title="Disabled" - aria-label="Next"> - Next - {{ safeHTML (readFile (print (partial "function-paths-static.html") "/icons/feather/arrow-right.svg")) }} - </button> - {{- end -}} + {{- with .Prev -}} + {{- $prevHref = .URL | absURL -}} + {{- $prevTitle = "Newer" -}} + {{- end -}} - {{ if and .HasNext .Last }} - <a - href="{{ .Last.URL }}" - aria-label="Last" - title="Next" - role="button"> - Last - </a> - {{ else }} - <button - data-invisible - title="Disabled" - aria-label="Last"> - Last - </button> - {{- end -}} - </paginator-navigation> -{{ end }} + {{- if .Next -}} + {{- $nextHref = .Next.URL | absURL -}} + {{- $nextTitle = "Older" -}} + {{- end -}} + + {{- if and .HasNext .Last -}} + {{- $lastHref = .Last.URL | absURL -}} + {{- $lastTitle = "Oldest" -}} + {{- end -}} + + <nav{{ if le .TotalPages 1 }} hidden="" {{ end }} data-type="pagination"> + <a rel="first" href="{{ $firstHref }}" title="{{ $firstTitle }}" > + <span>{{ $firstTitle }}</span> + </a> + + <a rel="prev" href="{{ $prevHref }}" title="{{ $prevTitle }}"> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }} + <span>{{ $prevTitle }}</span> + </a> + + <a rel="next" href="{{ $nextHref }}" title="{{ $nextTitle }}"> + <span>{{ $nextTitle }}</span> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-right.svg")) }} + </a> + + <a rel="last" href="{{ $lastHref }}" title="{{ $lastTitle }}" data-count="{{ .TotalPages }}"> + <span>{{ $lastTitle }}</span> + </a> + </nav> +{{- end -}} |