启用本地搜索

安装 hexo-generator-searchdb

1
2
3
# hexo-generator-searchdb GitHub仓库地址:
# https://github.com/theme-next/hexo-generator-searchdb
npm install hexo-generator-searchdb --save

配置

  1. 站点配置文件添加配置项如下:
    1
    2
    3
    4
    5
    6
    # Local Search
    search:
    path: search.xml # 文件路径,默认即可
    field: post # 搜索范围:post | page | all
    format: html
    limit: 10000
  2. 主题配置文件修改配置如下:
    在Next7.0默认集成,5.1.4没有,6.0不详
    1
    2
    3
    4
    5
    6
    7
    8
    # Post wordcount display settings
    # Dependencies: https://github.com/theme-next/hexo-symbols-count-time
    symbols_count_time:
    separated_meta: true
    item_text_post: true
    item_text_total: false
    awl: 4
    wpm: 275