From bfa66798b31ce2ab739d1609159ef37b19b8dd2c Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Wed, 14 Apr 2021 13:00:42 +0200 Subject: [PATCH] featured articles only shown in first page of home page --- layouts/index.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/layouts/index.html b/layouts/index.html index 0873660..c2eac74 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -5,15 +5,18 @@ {{ $allPostsList := where .Site.RegularPages "Section" "in" $postsDir }} {{ $featuredPostsList := slice }} {{ $postsList := $allPostsList }} + {{ $pagination := (.Paginate $postsList).Pages }} {{ if .Site.Params.enableFeatured | default false }} {{ $featuredPostsList = where $allPostsList "Params.featured" true }} {{ $postsList = union (where $allPostsList "Params.featured" false) (where $allPostsList "Params.featured" nil) }} - {{- partial "featured_articles.html" $featuredPostsList -}} + {{ if eq .Paginator.PageNumber 1 }} + {{- partial "featured_articles.html" $featuredPostsList -}} + {{ end }} {{ end }} {{/* pagination */}}
- {{ range (.Paginate $postsList).Pages }} + {{ range $pagination }}