安装

1
yarn add hexo-auto-category --save

配置

编辑 _config.yml

1
2
3
4
5
6
# Generate categories from directory-tree
# Dependencies: https://github.com/xu-song/hexo-auto-category
# depth: the max_depth of directory-tree you want to generate, should > 0
auto_category:
enable: true
depth:

如果只想生成第一级目录分类,可以设置 depth 属性,比如:

1
2
3
auto_category:
enable: true
depth: 1

参考资料