summaryrefslogtreecommitdiffstats
path: root/layouts/_default
diff options
context:
space:
mode:
authoramzrk22020-06-14 23:30:00 +0800
committeramzrk22020-06-14 23:30:00 +0800
commit72ccecdc5b8bd5fef140c706902eb2139068d748 (patch)
treead1e5741162d910a7f4af7cca6295ce71ee9ef6d /layouts/_default
parent89fc2917985d3da944af8116e101748267d66104 (diff)
downloadhugo-theme-fuji-72ccecdc5b8bd5fef140c706902eb2139068d748.tar.gz
hugo-theme-fuji-72ccecdc5b8bd5fef140c706902eb2139068d748.tar.bz2
hugo-theme-fuji-72ccecdc5b8bd5fef140c706902eb2139068d748.zip
Generate json for searching
Diffstat (limited to 'layouts/_default')
-rw-r--r--layouts/_default/index.json5
1 files changed, 5 insertions, 0 deletions
diff --git a/layouts/_default/index.json b/layouts/_default/index.json
new file mode 100644
index 0000000..a823e62
--- /dev/null
+++ b/layouts/_default/index.json
@@ -0,0 +1,5 @@
+{{- $.Scratch.Add "search" slice -}}
+{{- range (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) -}}
+ {{- $.Scratch.Add "search" (dict "title" .Title "tags" .Params.tags "contents" .Plain "permalink" .Permalink) -}}
+{{- end -}}
+{{- $.Scratch.Get "search" | jsonify -}} \ No newline at end of file