mirror of
https://github.com/naoufalzerai/zerai.xyz.git
synced 2025-12-24 22:43:58 +00:00
change theme again :D
This commit is contained in:
34
themes/notepadium/layouts/partials/pagination.html
Normal file
34
themes/notepadium/layouts/partials/pagination.html
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- $paginator := . -}}
|
||||
|
||||
{{- if gt $paginator.TotalPages 1 -}}
|
||||
|
||||
{{- $pageIndex := $paginator.PageNumber -}}
|
||||
{{- $totalPages := $paginator.TotalPages -}}
|
||||
{{- $cols := 5.0 -}}
|
||||
{{- $rows := math.Ceil (div $totalPages $cols) -}}
|
||||
{{- $row := math.Ceil (div $pageIndex $cols) -}}
|
||||
{{- $startPage := sub (mul $row $cols) $cols -}}
|
||||
{{- $endPage := add $startPage $cols -}}
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
{{- if gt $row 1 -}}
|
||||
<li><a href="{{- $paginator.Prev.URL -}}"><span class="iconfont icon-pagepreview"></span></a></li>
|
||||
{{- end -}}
|
||||
|
||||
{{- range $paginator.Pagers -}}
|
||||
{{- if and (gt .PageNumber $startPage) (le .PageNumber $endPage) -}}
|
||||
{{- $active := "" -}}
|
||||
{{- if eq .PageNumber $paginator.PageNumber -}}
|
||||
{{- $active = "active" -}}
|
||||
{{- end -}}
|
||||
<li><a class="{{- $active -}}" href="{{- .URL -}}">{{- .PageNumber -}}</a></li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if lt $row $rows -}}
|
||||
<li><a href="{{- $paginator.Next.URL -}}"><span class="iconfont icon-pagenext"></span></a></li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user