Feat: Add page nums in list pages

In site config =>
Params:
    ShowPageNums: true
This commit is contained in:
Aditya Telange 2022-08-15 19:25:55 +05:30
parent 6f0c88d2b8
commit eba92edd83
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77

View File

@ -87,10 +87,20 @@
<footer class="page-footer"> <footer class="page-footer">
<nav class="pagination"> <nav class="pagination">
{{- if $paginator.HasPrev }} {{- if $paginator.HasPrev }}
<a class="prev" href="{{ $paginator.Prev.URL | absURL }}">« {{ i18n "prev_page" }}</a> <a class="prev" href="{{ $paginator.Prev.URL | absURL }}">
«&nbsp;{{ i18n "prev_page" }}&nbsp;
{{- if (.Param "ShowPageNums") }}
{{- sub $paginator.PageNumber 1 }}/{{ $paginator.TotalPages }}
{{- end }}
</a>
{{- end }} {{- end }}
{{- if $paginator.HasNext }} {{- if $paginator.HasNext }}
<a class="next" href="{{ $paginator.Next.URL | absURL }}">{{ i18n "next_page" }} »</a> <a class="next" href="{{ $paginator.Next.URL | absURL }}">
{{- i18n "next_page" }}&nbsp;
{{- if (.Param "ShowPageNums") }}
{{- add 1 $paginator.PageNumber }}/{{ $paginator.TotalPages }}
{{- end }}&nbsp;»
</a>
{{- end }} {{- end }}
</nav> </nav>
</footer> </footer>