简体中文
append-date
该插件会基于 @vuepress/plugin-git 为 frontmatter 追加写作日期。
使用方法
npm i -D @vuepress/plugin-append-date@nextimport { appendDatePlugin } from '@vuepress/plugin-append-date'
export default {
plugins: [appendDatePlugin()],
}指南
时间格式
默认情况下,插件以 YYYY-MM-DD 格式将日期写入 date 键。
当 format 为 "time" 时,键名默认改为 time,值为 HH:mm:ss 格式的时间字符串。这样 date 键可以继续保存有效的页面日期。
如果 format 为 "time" 且显式设置 key: "date",仅含时间的值会破坏 page.date,因此插件会警告并改为写入 YYYY-MM-DD HH:mm:ss 格式的完整日期。
插件不会覆盖已存在的键。如果已有的 date 值是仅含时间的值,插件会发出警告,提醒你手动替换该值。
选项
key
string追加时间时使用的 frontmatter 键名。当 format 为 "time" 时默认为 time,否则为 date。
format
"date" | "time" | "full"默认值
"date"