aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/pagination.html
blob: 31bebeb6914b75c20c682b586747f5002b09dd0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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 }}>

      <a {{ $firstData | safeHTMLAttr }} href="{{ $firstHref }}" title="{{ $firstTitle }}" >
        {{ $firstTitle }}
      </a>

      <a rel="{{ $prevRel }}" {{ $prevData | safeHTMLAttr }} href="{{ $prevHref }}" title="{{ $prevTitle }}">
        {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-left.svg")) }}
        {{ $prevTitle }}
      </a>

      <a rel="{{ $nextRel }}" {{ $nextData | safeHTMLAttr }} href="{{ $nextHref }}" title="{{ $nextTitle }}">
        {{ $nextTitle }}
        {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-right.svg")) }}
      </a>

      <a {{ $lastData | safeHTMLAttr }} href="{{ $lastHref }}" title="{{ $lastTitle }}" >
        {{ $lastTitle }}
      </a>
  </paginator-navigation>
{{- end -}}