From 2f9f25f8c44da270e487411fba4150b85dea971e Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 27 Oct 2024 07:24:38 -0600 Subject: [PATCH] Omit drafts from the Prev/Next page navigation --- layouts/partials/page/prev_next_navigation.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layouts/partials/page/prev_next_navigation.html b/layouts/partials/page/prev_next_navigation.html index b584cfa..87ef301 100644 --- a/layouts/partials/page/prev_next_navigation.html +++ b/layouts/partials/page/prev_next_navigation.html @@ -1,6 +1,7 @@ -{{ if .Section }} - {{- $previousInSection := .PrevInSection -}} - {{- $nextInSection := .NextInSection -}} +{{ if .FirstSection }} + {{- $pages := where .FirstSection.RegularPagesRecursive "Draft" "eq" false -}} + {{- $previousInSection := $pages.Prev . -}} + {{- $nextInSection := $pages.Next . -}} {{ if or $previousInSection $nextInSection }}