From 02ed64708311f7cf6a57ef58fb5f3c17e5f3d5c8 Mon Sep 17 00:00:00 2001 From: Stefan Rakel Date: Fri, 22 Oct 2021 13:14:13 +0200 Subject: [PATCH] Honor draft status of pages --- layouts/index.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/layouts/index.html b/layouts/index.html index 9f3daa3..ee001f5 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,6 +1,13 @@ {{ define "main" }} {{ $headless := .Site.GetPage "/homepage" }} {{ $sections := $headless.Resources.ByType "page" }} +{{ $scratch := newScratch }} +{{ $scratch.Set "sections" $sections }} +{{ if not .Site.BuildDrafts }} + {{ $sections := where $sections "Draft" "!=" true}} + {{ $scratch.Set "sections" $sections }} +{{ end}} +{{ $sections := $scratch.Get "sections" }}