Skip to content

添加本地搜索

郑超 edited this page Mar 15, 2017 · 2 revisions

默认本地搜索是用原生JS写的,但还需要HEXO插件创建的JSON数据文件配合。安装插件hexo-generator-json-content来创建JSON数据文件:

npm install [email protected] --save

然后打开根目录下的配置文件_config.yml添加配置:

jsonContent:
  meta: false
  pages: false
  posts:
    title: true
    date: true
    path: true
    text: true
    raw: false
    content: false
    slug: false
    updated: false
    comments: false
    link: false
    permalink: false
    excerpt: false
    categories: false
    tags: true

最后打开主题配置文件themes/BlueLake/_config.yml添加配置:

local_search: true