实现_post文件夹内自动分类生成帖子

默认下 post全在一个文件夹并且手动配置一级目录

1
2
3
_post
帖子1.md
帖子2.md

现在要实现post内文件夹对帖子进行分类并且构建时自动分配该文件夹作为一级目录

插件安装

npm install hexo-auto-category --save

配置插件

1
2
3
4
5
6
# hexo-auto-category 配置
auto_category:
enable: true # 开启自动分类功能
depth: 1 # 只取一级文件夹作为分类
over_write: false # 不覆盖文章Front-matter中已有的categories配置
exclude: [] # 排除不需要自动分类的文件夹