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: 84925f8f2162a6750620bab0bb1e2d3e5eadc60e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{{- $.Scratch.Add "pages" slice -}}
{{- $.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 := (where .Site.Pages "Type" "posts") -}}
    {{- $.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" "pages" ($.Scratch.Get "pages") }}
{{- $.Scratch.SetInMap "searchindex" "tags" ($.Scratch.Get "tags") }}
{{- $.Scratch.SetInMap "searchindex" "categories" ($.Scratch.Get "categories") }}
{{- $.Scratch.Get "searchindex" | jsonify -}}