Fix pagination

master
Quentin Duchemin 2021-05-25 17:15:13 +02:00
parent 26bc31df07
commit 4ec5202d28
Signed by: Chosto
GPG Key ID: 0547178FEEDE7D6B
2 changed files with 5 additions and 3 deletions

View File

@ -9,7 +9,9 @@
</article> </article>
{{ end }} {{ end }}
<div class="columns is-multiline is-mobile"> <div class="columns is-multiline is-mobile">
{{ range .Paginator.Pages }} <!-- Custom paginator with only blog posts -->
{{ $paginator := .Paginate (where .Site.RegularPages "FirstSection.Section" "posts") }}
{{ range $paginator.Pages }}
{{ if (eq .FirstSection.Section "posts")}} {{ if (eq .FirstSection.Section "posts")}}
<div class="column is-one-third"> <div class="column is-one-third">
{{ .Render "summary" }} {{ .Render "summary" }}
@ -17,7 +19,7 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>
{{- partial "pagination.html" . -}} {{- partial "pagination.html" $paginator -}}
</main> </main>
</div> </div>
{{ end }} {{ end }}

View File

@ -1,4 +1,4 @@
{{ $pag := $.Paginator }} {{ $pag := . }}
{{ if gt $pag.TotalPages 1 -}} {{ if gt $pag.TotalPages 1 -}}
<nav class="mt-5 pagination is-centered" role="navigation" aria-label="pagination"> <nav class="mt-5 pagination is-centered" role="navigation" aria-label="pagination">
{{ with $pag.First -}} {{ with $pag.First -}}