Hexo增加搜索功能


文章作者: cyclezone
版权声明: 本文为博主「cyclezone」的原创文章,采用 CC BY 4.0 许可协议。转载请附上原文出处链接和本声明 cyclezone !

Hexo增加搜索功能具体操作

1.安装搜索

在Hexo的根目录下,打开命令可执行窗口,执行如下命令:

npm install hexo-generator-searchdb --save

2.全局配置文件_config.yml

新增如下内容:

search:
  path: search.xml
  field: post
  format: html
  limit: 10000

3.hexo主题配置文件(\themes\next_config.yml

修改local_searchenabletrue

# Local search
# Dependencies: https://github.com/flashlab/hexo-generator-search
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
文章作者: cyclezone
版权声明: 本文为博主「cyclezone」的原创文章,采用 CC BY 4.0 许可协议。转载请附上原文出处链接和本声明 cyclezone !

评论
  目录