local_search
local_search:
enable: false
preload: false # Preload the search data when the page loads
This configuration item is used to set the website search function, which is very practical and is recommended to be enabled. When enabled, a search button will appear on the right side of the navigation bar in the header.
Search function configuration process:
Install the plugin
hexo-generator-searchdb
in the root directory of the Hexo project.$ npm install hexo-generator-searchdb
Add the following configuration items at the bottom of the Hexo configuration file
_config.redefine.yml
.# Search
## See: https://github.com/theme-next/hexo-generator-searchdb
search:
path: search.json
field: post
content: true
format: striptagsThe value of the
local_search.enable
configuration item in the theme configuration file_config.redefine.yml
is set totrue
.local_search:
enable: true
tip
The local_search.preload
configuration item indicates whether to preload search data on page load.
Site-wide article search renderings: