使用hexo-related-popular-posts插件,实现博客相关文章推荐
版本
- Hexo 版本:
5.0.x
- Next 版本:
7.8.0
- hexo-generator-searchdb 版本:
5.0.0
安装
如果有安装淘宝镜像,可以使用cnpm安装
1 | $ npm install hexo-related-popular-posts --save |
或者
1 | $ cnpm install hexo-related-popular-posts --save |
如果安装遇到了问题,请看这里
配置
在next 主题配置文件_config.yml
,找到以下配置,开启开关
1 | related_posts: |
验证
清除缓存,打包,然后运行
1 | $ npm run clean |
问题
注意:我的安装过程很坎坷
一些安装过程中遇到的问题
npm install hexo-related-popular-posts –save 安装失败/安装后项目不能运行
解决方案:执行 npm uninstall hexo-related-popular-posts –save,然后使用cnpm方式安装cnpm install hexo-related-popular-posts –save 安装失败
解决方案:执行 cnpm install hexo-related-popular-posts –save –no-cacheTypeError: The “path” argument must be of type string. Received null
解决方案:npm run clean && npm run build && npm run server