hexo butterfly主题中怎么使用Algolia搜索?
文章摘要
Hai Chat
记得之前多次试着配置过Algolia搜索,都未能成功,今日又试了几次,还是不行。无奈,又去百度了一下,看到了cc的Hexo Butterfly Algolia 搜索的使用一文,跟着配置了一番,结果,意外的成功了,果断记录一下。
准备工作
前往Algolia官网注册一个账号,新建应用
和 index
安装插件
对于Algolia搜索,有两个插件,安装方式为:
1 | npm install hexo-algolia --save |
他们的官方介绍为:
- algolia:Index your hexo website content to Algolia Search.
- algoliasearch:🔎 A plugin to index posts of your Hexo blog on Algolia
我采用的是hexo-algoliasearch
配置
在站点congif_yml中加入以下配置
1 | algolia: |
APPiD
、apiKey
、adminApiKey
分别对应上面第三张图中的Application ID
、Search-Only API Key
、Admin API Key
indexName
为我们创建的index的名字
_config.butterfly.yml中的设置
1 | # Algolia search |
使用命令
1 | hexo algolia |
可选命令
1 | hexo algolia -n |
写在结尾
我这次配置完后,运行了一次:
1 | hexo algolia -n |
然后再部署,发现可以了,但是原来的教程也没有此说法啊,到底是我原来哪里配置有问题,还是确实需要运行一次这个命令呢?哎,谁知道呢?记录到此结束。
- 感谢您的赞赏。
赞赏名单
因为有你们的支持,我才体会到写文章的价值。
本文是原创文章,采用CC BY-NC-SA 4.0协议,完整转载请注明来自Hai sky
评论 ()