feat: add all method

This commit is contained in:
James Elliott
2022-06-25 13:36:32 +10:00
parent fa01f4ab56
commit b532c69bd7
3 changed files with 8 additions and 4 deletions

View File

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