Merge pull request #799 from james-d-elliott/feat-search-sections
feat(search): allow complete section customization
This commit is contained in:
@ -94,7 +94,20 @@ Source:
|
||||
|
||||
// https://discourse.gohugo.io/t/range-length-or-last-element/3803/2
|
||||
|
||||
{{ $list := (where .Site.Pages "Section" "docs") -}}
|
||||
{{ $list := slice }}
|
||||
{{- 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) }}
|
||||
{{- if (in .Site.Params.options.searchSectionsIndex "HomePage") }}
|
||||
{{ $list = $list | append .Site.Home }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $list = (where .Site.Pages "Section" "docs") }}
|
||||
{{- end }}
|
||||
|
||||
{{ $len := (len $list) -}}
|
||||
|
||||
{{ range $index, $element := $list -}}
|
||||
|
Reference in New Issue
Block a user