Add a should_render.html partial
Encapsulates the decision making about whether a page should be rendered.
This commit is contained in:
parent
94181c0f15
commit
c4821daa6e
3 changed files with 4 additions and 3 deletions
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
{{ with $page.RegularPages.ByPublishDate -}}
|
{{ with $page.RegularPages.ByPublishDate -}}
|
||||||
<section class="main__posts-by-year">
|
<section class="main__posts-by-year">
|
||||||
{{ range $page.RegularPages.ByPublishDate -}}
|
{{ range .Reverse -}}
|
||||||
{{ if or (not $page.Draft) hugo.IsDevelopment -}}
|
{{ if partial "page/should_render.html" . -}}
|
||||||
{{ .Render "page_summary" }}
|
{{ .Render "page_summary" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<section id="{{ .Date | time.Format "2006" }}" class="main__posts-by-year">
|
<section id="{{ .Date | time.Format "2006" }}" class="main__posts-by-year">
|
||||||
<h2 class="main__section-heading">{{ .Title }}</h2>
|
<h2 class="main__section-heading">{{ .Title }}</h2>
|
||||||
{{ range .RegularPagesRecursive.ByPublishDate.Reverse -}}
|
{{ range .RegularPagesRecursive.ByPublishDate.Reverse -}}
|
||||||
{{ if or (not .Draft) hugo.IsDevelopment -}}
|
{{ if partial "page/should_render.html" . -}}
|
||||||
{{ .Render "page_summary" }}
|
{{ .Render "page_summary" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
1
layouts/partials/page/should_render.html
Normal file
1
layouts/partials/page/should_render.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{{ return or (not .Draft) hugo.IsDevelopment }}
|
Loading…
Add table
Add a link
Reference in a new issue