使用hexo-related-popular-posts插件,实现博客相关文章推荐
版本
- Hexo 版本:
5.0.x
- Next 版本:
7.8.0
- hexo-generator-searchdb 版本:
5.0.0
安装
如果有安装淘宝镜像,可以使用cnpm安装
$ npm install hexo-related-popular-posts --save
或者
$ cnpm install hexo-related-popular-posts --save
如果安装遇到了问题,请看这里
配置
在next 主题配置文件_config.yml
,找到以下配置,开启开关
related_posts:
enable: true
title: # Custom header, leave empty to use the default one
display_in_home: false
params:
maxCount: 5
#PPMixingRate: 0.0
#isDate: false
#isImage: false
#isExcerpt: false
验证
清除缓存,打包,然后运行
$ npm run clean
$ npm run build
$ npm run server
问题
注意:我的安装过程很坎坷
一些安装过程中遇到的问题
-
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-cache -
TypeError: The “path” argument must be of type string. Received null
解决方案:npm run clean && npm run build && npm run server
完
欢迎逛一下楼主博客:liuqi-java.github.io