最后修改时间
输出文档的最后修改时间
用法
此功能默认未启用,您可以从配置文件中启用。请注意,它仅支持 Git 作为版本控制。 请确保您的机器上已安装 Git,并且 仓库未进行浅克隆,因为它依赖于您的本地 Git 历史。
import { defineConfig } from 'fumadocs-mdx/config';
export default defineConfig({
lastModifiedTime: 'git',
});访问属性
执行此操作后,将为每个文档导出 lastModified 数字。您可以将它转换为 JavaScript Date 对象。
import { source } from '@/lib/source';
const page = source.getPage(['...']);
console.log(new Date(page.data.lastModified));
// or with async mode:
const { lastModified } = await page.data.load();
console.log(new Date(lastModified));How is this guide?
Last updated on
