From 5c9638c51e62a913f7afea9f16f867a34b7e614b Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Sat, 29 Jul 2023 10:31:08 +0200 Subject: [PATCH] Fix warning: '.File.UniqueID on zero object' (#1007) --- layouts/partials/section-index.html | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/layouts/partials/section-index.html b/layouts/partials/section-index.html index e1c83154c1..c854d3bc75 100644 --- a/layouts/partials/section-index.html +++ b/layouts/partials/section-index.html @@ -1,31 +1,33 @@
- {{ $parent := .Page }} - {{ $pages := (where .Site.Pages "Section" .Section).ByWeight }} + {{ $parent := .Page -}} + {{ $pages := (where .Site.Pages "Section" .Section).ByWeight -}} {{ $pages = (where $pages "Type" "!=" "search") }} - {{ $pages = (where $pages ".Params.hide_summary" "!=" true) }} - {{ $pages = (where $pages ".Parent" "!=" nil) }} - {{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) }} - {{ if or $parent.Params.no_list (eq (len $pages) 0) }} + {{ $pages = (where $pages ".Params.hide_summary" "!=" true) -}} + {{ $pages = (where $pages ".Parent" "!=" nil) -}} + {{ with .Parent.File -}} + {{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) -}} + {{ end -}} + {{ if or $parent.Params.no_list (eq (len $pages) 0) -}} {{/* If no_list is true or we don't have subpages we don't show a list of subpages */}} - {{ else if $parent.Params.simple_list }} + {{ else if $parent.Params.simple_list -}} {{/* If simple_list is true we show a bulleted list of subpages */}} - {{ else }} + {{ else -}} {{/* Otherwise we show a nice formatted list of subpages with page descriptions */}}
- {{ range $pages }} - {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }} + {{ range $pages -}} + {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) -}}
{{- .Title -}}
-

{{ .Description | markdownify }}

+

{{ .Description | markdownify -}}

- {{ end }} - {{ end }} + {{ end -}} + {{ end -}}