A new way for search without any other dependencies but Hugo itself
As a fact, Hugo does have a way to generate .json format files of itself without any other dependencies. You can find it from Hugo official doc, and with some variables, you can generate a index.json file which looks like below:
Step 1:
Creat a new file with the name index.json, and put it into the path themes/you-theme-name/layouts/_default/index.json. Set the content of index.json the same as below:
Now everytime you hugo serve or hugo -b "" , Hugo will generate a index.json file in your site root.
As hugo-canoe-theme already have it's own way to render index.json file for searching in themes/canoe/static/js/index.js , you won't have to do other things.
A new way for search without any other dependencies but Hugo itself
As a fact, Hugo does have a way to generate
.json
format files of itself without any other dependencies. You can find it from Hugo official doc, and with some variables, you can generate aindex.json
file which looks like below:Only two steps, you'll get it:
index.json
, and put it into the paththemes/you-theme-name/layouts/_default/index.json
. Set the content ofindex.json
the same as below:config.toml
Now everytime you
hugo serve
orhugo -b ""
, Hugo will generate aindex.json
file in your site root.As
hugo-canoe-theme
already have it's own way to renderindex.json
file for searching inthemes/canoe/static/js/index.js
, you won't have to do other things.Summary
改完之后比较了一下,搜索能力与老方案比似乎还是差了一小点,应该可以从改善
canoe
内部的index.js
出发得以解决,因为Client side searching for Hugo.io with Fuse.js方案的搜索能力比老方案似乎还强有一些。博客https://kuleyu-hugo.netlify.com/就是采用了Fuse.js
方案。