Last Modified Time
Output the last modified time of a document
Usage
You can add the plugin from the config file.
Git is used by default
Please ensure you have Git installed on your machine, and the repository is not shallow cloned, as it relies on your local Git history.
import { defineConfig } from 'fumadocs-mdx/config';
import lastModified from 'fumadocs-mdx/plugins/last-modified';
export default defineConfig({
plugins: [lastModified()],
});Access the Property
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);How is this guide?
Last updated on
