{{/* Blog pagination component for list pages (e.g., blog list, category list) Usage: {{ partial "components/blog-pager.html" $paginator }} Parameters: - . (context): Hugo paginator object */}} {{- $paginator := . -}} {{- $prevText := (T "previous") | default "Prev" -}} {{- $nextText := (T "next") | default "Next" -}} {{- $prevLabel := printf "%s %d/%d" $prevText (sub $paginator.PageNumber 1) $paginator.TotalPages -}} {{- $nextLabel := printf "%s %d/%d" $nextText (add $paginator.PageNumber 1) $paginator.TotalPages -}} {{- if or $paginator.HasPrev $paginator.HasNext -}}
{{- if $paginator.HasPrev -}} {{- partial "utils/icon.html" (dict "name" "chevron-right" "attributes" "class=\"hx:inline hx:h-5 hx:shrink-0 hx:ltr:rotate-180\"") -}} {{ $prevLabel }} {{- end -}} {{- if $paginator.HasNext -}} {{ $nextLabel }} {{- partial "utils/icon.html" (dict "name" "chevron-right" "attributes" "class=\"hx:inline hx:h-5 hx:shrink-0 hx:rtl:-rotate-180\"") -}} {{- end -}}
{{- end -}}