pagination.html 1.2 KB

1234567891011121314151617181920212223242526
  1. {{ if gt .Paginator.TotalPages 1 }}
  2. <nav class='pagination'>
  3. {{ $.Scratch.Set "hasPrevDots" false }}
  4. {{ $.Scratch.Set "hasNextDots" false }}
  5. {{ range .Paginator.Pagers }}
  6. {{ if eq . $.Paginator }}
  7. <span class='page-link current'>
  8. {{- .PageNumber -}}
  9. </span>
  10. {{ else if or (or (eq . $.Paginator.First) (eq . $.Paginator.Prev)) (or (eq . $.Paginator.Next) (eq . $.Paginator.Last )) }}
  11. <a class='page-link' href='{{ .URL }}'>
  12. {{- .PageNumber -}}
  13. </a>
  14. {{ else }}
  15. {{ if and (not ($.Scratch.Get "hasPrevDots")) (lt .PageNumber $.Paginator.PageNumber) }}
  16. {{ $.Scratch.Set "hasPrevDots" true }}
  17. <span class='page-link dots'>&hellip;</span>
  18. {{ else if and (not ($.Scratch.Get "hasNextDots")) (gt .PageNumber $.Paginator.PageNumber) }}
  19. {{ $.Scratch.Set "hasNextDots" true }}
  20. <span class='page-link dots'>&hellip;</span>
  21. {{ end }}
  22. {{ end }}
  23. {{ end }}
  24. </nav>
  25. {{ end }}