hexo add local search

description: add a local search for hexo blog

install hexo-generator-search

run following commend under search4fan.github.io/ folder

1
npm install hexo-generator-search --save

change configuration

add following text in search4fan.github.io/_config.yml

1
2
3
search: 
path: search.xml
field: post

change theme configuration

change _config.yml under theme folder search4fan.github.io/themes/next/_config.yml

1
2
3
4
5
6
7
8
9
10
11
# Local search
# Dependencies: https://github.com/theme-next/hexo-generator-searchdb
local_search:
enable: true
# if auto, trigger search by changing input
# if manual, trigger search by pressing enter key or search button
trigger: auto
# 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


more on search4fan.github.io