最后修改时间
输出文档的最后修改时间
使用
🌐 Usage
你可以从配置文件中添加插件。
🌐 You can add the plugin from the config file.
默认使用 Git
请确保你的计算机上已安装 Git,并且仓库不是浅克隆的,因为它依赖于你本地的 Git 历史记录。
import { defineConfig } from 'fumadocs-mdx/config';
import lastModified from 'fumadocs-mdx/plugins/last-modified';
export default defineConfig({
plugins: [lastModified()],
});访问属性
🌐 Access the Property
完成此操作后,每个文档都会导出一个 lastModified 属性(作为 Date)。
🌐 After doing this, a lastModified property will be exported for each document (as Date).
import { source } from '@/lib/source';
const page = source.getPage(['...']);
console.log(page.data.lastModified);
// or with lazy loading
const { lastModified } = await page.data.load();
console.log(lastModified);Last updated on
