hexo配置algolia,执行hexo algolia报错问题

2019-08-23  本文已影响0人  张雨生在路上

NexT官方主题配置:http://theme-next.iissnan.com/third-party-services.html#algolia-search

踩坑一:配置文件格式不正确

1、按照官方配置Algolia搜索后,在git bash上执行hexo algolia报错:

ERROR [Algolia] Please provide an Algolia index name in your hexo _config.yml file.
ERROR >> Read https://npmjs.com/hexo-algolia#public-facing-search-options for more informations.

报错内容提示找不到index name,检查_config.yml 的确配上了。见下图,


_config.yml配置

后来发现,配置项前要加上缩进。再次修改后,再次执行hexoalgolia就可以成功搭建啦。


hexo_config.png

踩坑二:配置文件缺失

部署好之后,点击页面上的搜索无响应。查看控制台,发现报错,设置无效:

Algolia Settings are invalid.

再次检查配置发现和官方要求的配置项一样。度娘后,发现竟然还要加入apiKey和adminApiKey。才能正常使用。


hexo_config_a.png

加上后再部署下。点击页面搜索,大功告成。

上一篇下一篇

猜你喜欢

热点阅读