From afe947a85f86858b2d919435ebc338e06835210e Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Wed, 14 Apr 2021 13:35:02 +0200 Subject: [PATCH] fixed pagination with featured posts --- layouts/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/layouts/index.html b/layouts/index.html index c2eac74..6f37a5f 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -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 */}}