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

list.searchindex.json « _default « layouts - github.com/xiaoheiAh/hugo-theme-pure.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cf2f165f7e3798968aece90fc836acadeae480e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{{- $.Scratch.Add "categories" slice -}}
{{- range .Site.Taxonomies.categories -}}
    {{- $.Scratch.Add "categories" (dict "title" .Page.Title "uri" .Page.Permalink ) -}}
{{- end -}}
{{- $.Scratch.Add "tags" slice -}}
{{- range .Site.Taxonomies.tags -}}
    {{- $.Scratch.Add "tags" (dict "title" .Page.Title "uri" .Page.Permalink) -}}
{{- end -}}
{{- $.Scratch.Add "posts" slice -}}

{{- range $index, $element := $.Scratch.Get "pages" -}}
    {{- $.Scratch.Add "posts" (dict "id" $index "title" $element.Title "uri" $element.Permalink "tags" $element.Params.tags "section" $element.Section "content" $element.Plain "summary" $element.Summary "year" ($element.Date.Format "2006")) -}}
{{- end -}}
{{- $.Scratch.SetInMap "searchindex" "posts" ($.Scratch.Get "posts") }}
{{- $.Scratch.SetInMap "searchindex" "tags" ($.Scratch.Get "tags") }}
{{- $.Scratch.SetInMap "searchindex" "categories" ($.Scratch.Get "categories") }}
{{- $.Scratch.Get "searchindex" | jsonify -}}