fix: avoid error if unset

This commit is contained in:
James Elliott
2022-06-25 12:20:57 +10:00
parent 00e4a7886e
commit fa01f4ab56
3 changed files with 17 additions and 7 deletions

View File

@ -95,7 +95,7 @@ Source:
// https://discourse.gohugo.io/t/range-length-or-last-element/3803/2
{{ $list := slice }}
{{- if eq (len .Site.Params.options.searchSectionsIndex) 0 }}
{{- if or (not (isset .Site.Params.options "searchsectionsindex")) (eq (len .Site.Params.options.searchSectionsIndex) 0) }}
{{- $list = (where .Site.Pages "Section" "docs") }}
{{- else }}
{{- $list = (where .Site.Pages "Type" "in" .Site.Params.options.searchSectionsIndex) }}