Hexo next主題添加站內搜索功能


根據關鍵字搜索博文,站內搜索的功能很實用。hexo開啟站內搜索很方便,已經有現成的插件可以使用,也是為了方便自己

  1. 安裝插件
npm install hexo-generator-search  --save
npm install hexo-generator-searchdb --save
  1. 配置hexo站點主配置文件_config.yml,在文件末尾添加
search:
  path: search.xml
  field: post
  format: html
  limit: 10000
  1. 修改next主題配置文件_config.yml,啟用 local_search
# Local search
local_search:
  enable: false
  # 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

將 enable的 false改為true

這樣就開啟了站內搜索了。

References
  1. Hexo開啟站內搜索功能


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM