diff options
author | amzrk2 | 2020-06-14 23:30:00 +0800 |
---|---|---|
committer | amzrk2 | 2020-06-14 23:30:00 +0800 |
commit | 72ccecdc5b8bd5fef140c706902eb2139068d748 (patch) | |
tree | ad1e5741162d910a7f4af7cca6295ce71ee9ef6d | |
parent | 89fc2917985d3da944af8116e101748267d66104 (diff) | |
download | hugo-theme-fuji-72ccecdc5b8bd5fef140c706902eb2139068d748.tar.gz hugo-theme-fuji-72ccecdc5b8bd5fef140c706902eb2139068d748.tar.bz2 hugo-theme-fuji-72ccecdc5b8bd5fef140c706902eb2139068d748.zip |
Generate json for searching
-rw-r--r-- | exampleSite/config.toml | 2 | ||||
-rw-r--r-- | layouts/_default/index.json | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 72e22b7..7df8ba0 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -2,6 +2,8 @@ baseURL = "https://example.com" title = "Hugo Theme Fuji" theme = "fuji" +[outputs] + home = ["html", "rss", "json"] hasCJKLanguage = true enableEmoji = true enableRobotsTXT = true 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 |