fixed pagination with featured posts

This commit is contained in:
Gabriele Musco 2021-04-14 13:35:02 +02:00
parent 9b52e91c96
commit afe947a85f
No known key found for this signature in database
GPG Key ID: 8539FD3454380B83
1 changed files with 4 additions and 1 deletions

View File

@ -5,13 +5,16 @@
{{ $allPostsList := where .Site.RegularPages "Section" "in" $postsDir }}
{{ $featuredPostsList := slice }}
{{ $postsList := $allPostsList }}
{{ $pagination := (.Paginate $postsList).Pages }}
{{ $pagination := slice }}
{{ if .Site.Params.enableFeatured | default false }}
{{ $featuredPostsList = where $allPostsList "Params.featured" true }}
{{ $postsList = union (where $allPostsList "Params.featured" false) (where $allPostsList "Params.featured" nil) }}
{{ $pagination = (.Paginate $postsList).Pages }}
{{ if eq .Paginator.PageNumber 1 }}
{{- partial "featured_articles.html" $featuredPostsList -}}
{{ end }}
{{ else }}
{{ $pagination = (.Paginate $postsList).Pages }}
{{ end }}
{{/* pagination */}}