安装插件:

1
npm install hexo-generator-search --save

修改_config.yml文件,添加以下内容

1
2
3
4
5
6
# 添加本地搜索
search:
path: search.xml
field: post
content: true
format: html

修改_config.butterfly.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: