22 lines
848 B
JSON
22 lines
848 B
JSON
|
{{- $.Scratch.Add "index" slice -}}
|
||
|
{{- $searchableExtras := site.Params.otherSearchableFields }}
|
||
|
{{- range site.Pages -}}
|
||
|
{{ $params := .Params }}
|
||
|
{{- if ne .Type "search" -}}
|
||
|
{{- $searchEntry := dict "title" .Title "body" .Plain "link" .Permalink "section" .Section }}
|
||
|
{{- range $index, $value := $searchableExtras }}
|
||
|
{{- $extraFieldValue := index $params $value }}
|
||
|
{{- $extraFieldValues := dict }}
|
||
|
{{- with $extraFieldValue }}
|
||
|
{{- $v := . }}
|
||
|
{{- if reflect.IsSlice . }}
|
||
|
{{- $v = delimit . "," }}
|
||
|
{{- end }}
|
||
|
{{- $extraFieldValues = dict (lower $value) $v }}
|
||
|
{{- end }}
|
||
|
{{- $searchEntry = merge $searchEntry $extraFieldValues }}
|
||
|
{{- end }}
|
||
|
{{- $.Scratch.Add "index" $searchEntry -}}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|
||
|
{{- jsonify (uniq ($.Scratch.Get "index")) -}}
|