{{ $paginator := $.Paginator }}
{{ if ne .Kind "home" }}
    {{ $paginator = .Data }}
{{ end }}
{{ if gt $paginator.TotalPages 1 }}
<nav aria-label="page navigation">
    <ul class="pagination">
    {{ if and (ne $paginator.PageNumber 1) (ne $paginator.PageNumber 2) }}
        <a href="{{ $paginator.First.URL }}" rel="first" class="page-link"><li class="page-item">«<span class="tablet-hidden"> First</span></li></a>
    {{ end }}

    {{ if $paginator.HasPrev  }}
        <a href="{{ $paginator.Prev.URL }}" rel="prev" class="page-link"><li class="page-item">‹<span class="tablet-hidden"> Prev</span></li></a>
    {{ end }}

{{ range $paginator.Pagers }}
    {{ if eq . $paginator }}
        <a href="{{ .URL }}" class="page-link"><li class="page-item active">{{ .PageNumber }}</li></a>
    {{ else if and (ge .PageNumber (sub $paginator.PageNumber 2)) (le .PageNumber (add $paginator.PageNumber 2)) }}
        <a href="{{ .URL }}" class="page-link mobile-hidden"><li class="page-item">{{ .PageNumber }}</li></a>
    {{ end }}
{{ end }}

    {{ if $paginator.HasNext }}
        <a href="{{ $paginator.Next.URL }}" rel="next" class="page-link"><li class="page-item"><span class="tablet-hidden">Next </span>›</li></a>
    {{ end }}

    {{ if and (ne $paginator.PageNumber $paginator.TotalPages) ((ne $paginator.PageNumber (sub $paginator.TotalPages 1))) }}
        <a href="{{ $paginator.Last.URL }}" rel="last" class="page-link"><li class="page-item"><span class="tablet-hidden">Last </span>»</li></a>
    {{ end }}
    </ul>
</nav>
{{ end }}
