[Hexo] Use hexo-generator-searchdb plugin and hexo-theme-next (NexT) theme to enable local search in Hexo
Hexo is a fast, simple & powerful blog framework. It use plugins to provide features powerful APIs for limitless extensibility. Various plugins are available to support most template engines (EJS, Pug, Nunjucks, and many others). Easily integrate with existing NPM packages (Babel, PostCSS, Less/Sass, etc).
hexo-generator-searchdb is used for generating a search index file, which contains all the necessary data of your articles that you can use to write a local search engine for your blog. Supports both XML and JSON format output.
npm to install
npm install hexo-generator-searchdb
First, configure this plugin in your Hexo root
_config.yml. All the arguments are optional.
The follow is the options:
path - file path. By default is search.xml. If the file extension is .json, the output format will be JSON. Otherwise XML format file will be exported.
field - the search scope you want to search, you can chose:
post (Default) - will only cover all the posts of your blog.
page - will only cover all the pages of your blog.
all - will cover all the posts and pages of your blog.
content - whether contains the whole content of each article. If false, the generated results only cover title and other meta info without mainbody. By default is true.
format - the form of the page contents, options are:
html (Default) - original html string being minified.
striptags - original html string being minified, and remove all the tags.
raw - markdown text of each posts or pages.
Then, configure this plugin in your
Finally, you can visit your site in the browser, and check whether the site works correctly after Hexo restarted or regenerated.
 hexojs/hexo-generator-searchdb: Add nofollow attribute to all external links automatically. - https://github.com/hexojs/hexo-generator-searchdb/
 Local Search - 第三方服务集成 - NexT 使用文档 - https://theme-next.iissnan.com/third-party-services.html#local-search
 next-theme/awesome-next: 😎 Theme NexT, AWESOME NexT! - https://github.com/next-theme/awesome-next