Skip to content

Commit

Permalink
fix issue with section index partial
Browse files Browse the repository at this point in the history
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 <tobias@kohlbau.de>
  • Loading branch information
tobiaskohlbau authored and chalin committed Apr 8, 2024
1 parent 820775e commit 3c6da48
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion layouts/partials/section-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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) -}}
Expand Down

0 comments on commit 3c6da48

Please sign in to comment.