From e8fbf28522b23e96fd322cab1accffde369361ef Mon Sep 17 00:00:00 2001 From: Tobias Kohlbau Date: Mon, 11 Mar 2024 15:37:09 +0100 Subject: [PATCH] fix issue with section index partial During rendering the section index of a docs list it could happen that a file has no parent for e.g. the homepage. If such scenario is existing the .Parent.File of a file is nil. Therefore this case should be handled within the rendering itself. Fixes #1874 Signed-off-by: Tobias Kohlbau --- layouts/partials/section-index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/partials/section-index.html b/layouts/partials/section-index.html index 845d5c6148..0ce414e74d 100644 --- a/layouts/partials/section-index.html +++ b/layouts/partials/section-index.html @@ -4,7 +4,8 @@ {{ $pages = (where $pages "Type" "!=" "search") }} {{ $pages = (where $pages ".Params.hide_summary" "!=" true) -}} {{ $pages = (where $pages ".Parent" "!=" nil) -}} - {{ if and .Parent .Parent.File -}} + {{ $pages = (where $pages ".Parent.File" "!=" nil) -}} + {{ if and $parent $parent.File -}} {{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) -}} {{ end -}} {{ if or $parent.Params.no_list (eq (len $pages) 0) -}}