From c4821daa6e080cc16f339884d022c243b163c0dc Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 13 Nov 2024 17:03:17 -0800 Subject: [PATCH] Add a should_render.html partial Encapsulates the decision making about whether a page should be rendered. --- layouts/partials/page/descendent_section.list.html | 4 ++-- layouts/partials/page/first_section.list.html | 2 +- layouts/partials/page/should_render.html | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 layouts/partials/page/should_render.html diff --git a/layouts/partials/page/descendent_section.list.html b/layouts/partials/page/descendent_section.list.html index f96f402..cd93df7 100644 --- a/layouts/partials/page/descendent_section.list.html +++ b/layouts/partials/page/descendent_section.list.html @@ -9,8 +9,8 @@ {{ with $page.RegularPages.ByPublishDate -}}
- {{ range $page.RegularPages.ByPublishDate -}} - {{ if or (not $page.Draft) hugo.IsDevelopment -}} + {{ range .Reverse -}} + {{ if partial "page/should_render.html" . -}} {{ .Render "page_summary" }} {{ end }} {{ end }} diff --git a/layouts/partials/page/first_section.list.html b/layouts/partials/page/first_section.list.html index 2dc62e3..6a931d7 100644 --- a/layouts/partials/page/first_section.list.html +++ b/layouts/partials/page/first_section.list.html @@ -25,7 +25,7 @@

{{ .Title }}

{{ range .RegularPagesRecursive.ByPublishDate.Reverse -}} - {{ if or (not .Draft) hugo.IsDevelopment -}} + {{ if partial "page/should_render.html" . -}} {{ .Render "page_summary" }} {{ end }} {{ end }} diff --git a/layouts/partials/page/should_render.html b/layouts/partials/page/should_render.html new file mode 100644 index 0000000..739b46d --- /dev/null +++ b/layouts/partials/page/should_render.html @@ -0,0 +1 @@ +{{ return or (not .Draft) hugo.IsDevelopment }}