Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.json « layouts - github.com/zzossig/hugo-theme-zzo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d2ba08a4339586e4cc59fdae46e96b90ccbbc2aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
{{ .Scratch.Delete "searchindex" }}
{{- $.Scratch.Add "searchindex" slice -}}
{{- range $index, $element := (where .Site.RegularPages "Kind" "page") -}}
  {{ with $element.Plain }}
    {{- if $.Param "searchContent" -}}
      {{- $.Scratch.Add "searchindex" (dict "id" $index "title" $element.Title "uri" $element.Permalink "tags" $element.Params.tags "section" $element.Section "content" $element.Plain "description" $element.Description) -}}
    {{ else }}
      {{- $.Scratch.Add "searchindex" (dict "id" $index "title" $element.Title "uri" $element.Permalink "tags" $element.Params.tags "section" $element.Section "description" $element.Description) -}}
    {{- end -}}
  {{ end }}
{{- end -}}
{{- $.Scratch.Get "searchindex" | jsonify -}}