fixed pagination with featured posts
This commit is contained in:
parent
9b52e91c96
commit
afe947a85f
|
@ -5,13 +5,16 @@
|
||||||
{{ $allPostsList := where .Site.RegularPages "Section" "in" $postsDir }}
|
{{ $allPostsList := where .Site.RegularPages "Section" "in" $postsDir }}
|
||||||
{{ $featuredPostsList := slice }}
|
{{ $featuredPostsList := slice }}
|
||||||
{{ $postsList := $allPostsList }}
|
{{ $postsList := $allPostsList }}
|
||||||
{{ $pagination := (.Paginate $postsList).Pages }}
|
{{ $pagination := slice }}
|
||||||
{{ if .Site.Params.enableFeatured | default false }}
|
{{ if .Site.Params.enableFeatured | default false }}
|
||||||
{{ $featuredPostsList = where $allPostsList "Params.featured" true }}
|
{{ $featuredPostsList = where $allPostsList "Params.featured" true }}
|
||||||
{{ $postsList = union (where $allPostsList "Params.featured" false) (where $allPostsList "Params.featured" nil) }}
|
{{ $postsList = union (where $allPostsList "Params.featured" false) (where $allPostsList "Params.featured" nil) }}
|
||||||
|
{{ $pagination = (.Paginate $postsList).Pages }}
|
||||||
{{ if eq .Paginator.PageNumber 1 }}
|
{{ if eq .Paginator.PageNumber 1 }}
|
||||||
{{- partial "featured_articles.html" $featuredPostsList -}}
|
{{- partial "featured_articles.html" $featuredPostsList -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $pagination = (.Paginate $postsList).Pages }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{/* pagination */}}
|
{{/* pagination */}}
|
||||||
|
|
Loading…
Reference in New Issue