mirror of
https://github.com/naoufalzerai/zerai.xyz.git
synced 2025-11-09 23:15:53 +00:00
34 lines
1.2 KiB
HTML
34 lines
1.2 KiB
HTML
{{- $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 -}} |