🇨🇦
hexo-theme-redefine
BlogGithub
English
English
  • Project Description
  • Get Started
    • Installation
    • Update
    • Usage
  • Configuration
    • Create a theme config file
    • base_info
    • style
      • primary_color
      • avatar
      • favicon
      • article_img_align
      • left_side_width
      • content_max_width
      • nav_color
      • hover
      • first_screen
      • scroll
    • social_contact
    • menu
    • home_article
    • post
      • word_count
      • author_label
    • toc
    • copyright_info
    • website_count
    • local_search
    • comment
      • use
      • Waline
      • Gitalk
      • Twikoo
    • rss
    • lazyload
    • cdn
    • pjax
    • footer
  • Advanced
    • Create a page
    • Note modules
    • Article top
    • Mathematical formula
    • Friendship style
    • file comparison
    • Resource compression
Powered by GitBook
On this page
  1. Configuration

local_search

Previouswebsite_countNextcomment

Last updated 2 years ago

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.

Screen Shot 2022-10-02 at 10.19.28 AM

Search function configuration process:

  1. Install the plugin hexo-generator-searchdb in the root directory of the Hexo project.

    $ npm install hexo-generator-searchdb
  2. 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: striptags
  3. The value of the local_search.enable configuration item in the theme configuration file _config.redefine.yml is set to true.

    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:

Screen Shot 2022-10-02 at 10.22.29 AM