compose-theme/layouts/_default/index.json

22 lines
848 B
JSON
Raw Permalink Normal View History

2024-07-26 17:08:59 +02:00
{{- $.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")) -}}