Hexo站内检索插件安装

Quick Start

NexT主题支持集成 Swiftype、 微搜索、Local Search 和 Algolia,Swiftype和Algolia都只有一段时间的试用期,可以采用Hexo提供的Local Search,原理是通过hexo-generator-search插件在本地生成一个search.xml文件,搜索的时候从这个文件中根据关键字检索出相应的链接。

安装步骤

在站点根目录下执行:

1
npm install hexo-generator-search --save
1
npm install hexo-generator-searchdb --save

编辑站点配置文件_config.yml,新增以下内容:

1
2
3
4
5
search:
path: search.xml
field: post
format: html
limit: 10000

然后在主题配置文件下启用local_search

1
2
3
4
# Local search
# Dependencies: https://github.com/flashlab/hexo-generator-search
local_search:
enable: true

更多插件安装

安装hexo-generator-feed

1
npm install hexo-generator-feed --save

站点配置文件_config.yml

1
2
3
4
5
6
7
8
9
10
# Extensions
## Plugins: http://hexo.io/plugins/
#RSS订阅
plugin:
- hexo-generator-feed
#Feed Atom
feed:
type: atom
path: atom.xml
limit: 20

在你的next主题下的_config.yml添加RSS订阅链接

1
rss: /atom.xml

给博客生成站点地图

安装hexo-generator-seo-friendly-sitemap

1
npm install hexo-generator-seo-friendly-sitemap --save

在站点配置文件_config.yml 中添加

1
2
sitemap:
path: sitemap.xml

结束

重新上传后,即可看到站内搜索功能。

Fiveplus wechat
扫一扫上方二维码,关注微信公众号:阿五编程
如果这篇文章对你有所帮助,请点击下方的打赏按钮。