auto-front-matter是什么

这是一个hexo插件,详细请见原作者blog

出现的问题与解决方案

按照原作者的README,在配置此插件时应在配置项开头加入enable:true

1
2
3
4
5
6
7
8
9
10
11
# hexo-auto-front-matter 配置
auto_front_matter:
enable: true # 这行配置出现了问题

# 自动填充创建日期
auto_date:
enable: true # 启用自动生成日期

# 自动填充更新日期
auto_updated:
enable: true # 启用自动生成更新日期

但此时会报错 TypeError: Cannot read properties of undefined (reading ‘enable’)

解决方案为将启用插件的第一行enable删除即可,正确写法如下

1
2
3
4
5
6
7
8
9
# hexo-auto-front-matter 配置
auto_front_matter:
# 自动填充创建日期
auto_date:
enable: true # 启用自动生成日期

# 自动填充更新日期
auto_updated:
enable: true # 启用自动生成更新日期