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

github.com/zzossig/hugo-theme-zdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/index.json')
-rw-r--r--layouts/index.json17
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