Hexo博客添加站内搜索功能


在cmd中安装插件

首先通过以下npm命令安装一个hexo-generator-search

npm install hexo-generator-search --save

更改主题配置文件

找到主题文件夹下的\themes\next_config.yml文件,并添加以下代码:

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
  # Preload the search data when the page loads.
  preload: false

然后重新运行Hexo博客即可

hexo clean
hexo g
hexo d

  目录