stkevintan / canoe Goto Github PK
View Code? Open in Web Editor NEWA beautifull and powerfull material design theme of hugo
License: MIT License
A beautifull and powerfull material design theme of hugo
License: MIT License
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:
[
{
"categories": ["A","B"],
"content": "article content .........",
"oriTitle": "article title",
"permalink": "article url",
"tags": ["tagA","tagB","tabC"],
"title": "file title"
}
];
Only two steps, you'll get it:
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:{{- $.Scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}}
{{- $.Scratch.Add "index" (dict "oriTitle" .Params.title "title" .Title "tags" .Params.tags "categories" .Params.categories "content" .Plain "permalink" .Permalink) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}
config.toml
[outputs]
home = ["HTML", "RSS", "JSON"]
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.
改完之后比较了一下,搜索能力与老方案比似乎还是差了一小点,应该可以从改善 canoe
内部的 index.js
出发得以解决,因为Client side searching for Hugo.io with Fuse.js方案的搜索能力比老方案似乎还强有一些。博客https://kuleyu-hugo.netlify.com/就是采用了 Fuse.js
方案。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.