aboutsummaryrefslogtreecommitdiffstats
path: root/layouts/partials/pagination.html
blob: 7e5eeb31aad03fe5c1f36c7daf61a0d407dacfa3 (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
{{ $pag := $.Paginator }}
{{ if gt $pag.TotalPages 1 }}
  <nav class="flex items-center justify-center p-8">
    {{ if $pag.HasPrev }}
      <a
        href="{{ $pag.Prev.URL }}"
        rel="prev"
        class="text-black transition hover:scale-105 hover:bg-gray-100 p-2 border"
        >« {{ T "prev" }}</a
      >
    {{ end }}
    {{ range $pag.Pagers }}
      {{ if eq . $pag }}
        <span class="text-white bg-gray-400 mx-1 p-2 border">
          {{ $pag.PageNumber }}</span
        >
      {{ else }}
        <a
          href="{{ .URL }}"
          class="block text-black transition hover:scale-105 hover:bg-gray-100 p-2 border"
          >{{ .PageNumber }}</a
        >
      {{ end }}
    {{ end }}
    {{ if $pag.HasNext }}
      <a
        href="{{ $pag.Next.URL }}"
        rel="next"
        class="text-black transition hover:scale-105 hover:bg-gray-100 p-2 border"
        >{{ T "next" }} »</a
      >
    {{ end }}
  </nav>
{{ end }}