使用hexo-generator-search给博客添加搜索功能

安装hexo-generator-search

1
npm install hexo-generator-search --save

配置Hexo的_config.yml

1
2
3
4
search:
path: search.xml
field: post
content: true

配置butterfly的_config.yml

1
2
3
4
5
6
7
8
9
10
# Local search
local_search:
enable: true
# Preload the search data when the page loads.
preload: false
# Show top n results per article, show all results by setting to -1
top_n_per_article: 1
# Unescape html strings to the readable one.
unescape: false
CDN:

重新构建

1
2
3
4
5
6
# setp 1
hexo clean
# setp 2
hexo generate
# or
hexo server