mirror of https://github.com/onweru/compose.git

weru
31.34.2025 58b2d2b2cb07aecd69e2a538e6a3b550cd726b51
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{{- $.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")) -}}