diff options
Diffstat (limited to 'layouts/index.json')
-rw-r--r-- | layouts/index.json | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/layouts/index.json b/layouts/index.json index 367f3b3..0a96038 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -1,12 +1,7 @@ -[{{ range $index, $page := .Site.Pages }} -{{- if ne $page.Type "json" -}} -{{- if and $index (gt $index 0) -}},{{- end }} -{ - "uri": "{{ $page.Permalink }}", - "title": "{{ htmlEscape $page.Title}}", - "tags": [{{ range $tindex, $tag := $page.Params.tags }}{{ if $tindex }}, {{ end }}"{{ $tag| htmlEscape }}"{{ end }}], - "description": "{{ htmlEscape .Description}}", - "content": {{$page.Plain | jsonify}} -} +{{- $.Scratch.Add "searchindex" slice -}} +{{- range $index, $element := (where .Site.Pages "Kind" "page") -}} + {{ with $element.Plain }} + {{- $.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) -}} + {{ end }} {{- end -}} -{{- end -}}]
\ No newline at end of file +{{- $.Scratch.Get "searchindex" | jsonify -}}
\ No newline at end of file |