From 2791315cbd2e16c93293c3c813471f6e844fc1a9 Mon Sep 17 00:00:00 2001 From: Mahdi Pourismaiel Date: Mon, 4 May 2020 09:27:22 +0430 Subject: [PATCH] Fix duplicate section pages in list fragment --- layouts/partials/helpers/list-pages.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/layouts/partials/helpers/list-pages.html b/layouts/partials/helpers/list-pages.html index e00bfea4..b5ef31a6 100644 --- a/layouts/partials/helpers/list-pages.html +++ b/layouts/partials/helpers/list-pages.html @@ -10,9 +10,11 @@ {{- end -}} {{- end -}} -{{- .page_scratch.Set "pages" (.page_scratch.Get "page").Pages -}} -{{- if .Params.subsections -}} - {{- .page_scratch.Add "pages" (.page_scratch.Get "page").Sections -}} +{{- .page_scratch.Set "pages" slice -}} +{{- range (.page_scratch.Get "page").Pages -}} + {{- if or $.Params.subsections (ne .Kind "section") -}} + {{- $.page_scratch.Add "pages" . -}} + {{- end -}} {{- end -}} {{- if .Params.subsection_leaves -}} {{- range (.page_scratch.Get "page").Sections -}}