fumadocs
fumadocs copied to clipboard
add a lastUpdated option to frontmatterSchema
What problem will this feature address?
I want to be able to have a last updated option on my pages whilst having control over the last updated time. For example might only change one thing like size of an image, but the content is the same. Meaning the document i created hasn't actually changed content so hasn't technically been updated. But according to git the page has been updated meaning the existing lastModified time that uses the git file will say the file has been modified.
Describe the solution you'd like
Add an option where i can manually add a last modified time in the frontmatterSchema like so:
---
title: Tools
lastUpdated: 2023-05-01
---
and is available from page.data like so:
{
title: 'Tools',
lastUpdated: 2023-05-01T00:00:00.000Z,
exports: {
default: [Function: MDXContent],
lastModified: undefined,
structuredData: { contents: [], headings: [] },
toc: []
}
}
So that the data can be called upon and placed on the page where necessary. It will also allow me to decide which pages have the last modified time on.
And force the user to input a datetype so the data can be displayed how they want
This can be done by updating the packages/mdx/src/utils/schema.ts file to allow this
Describe alternatives you've considered
Nothing i have really considered
Additional context
I am happy to add this feature as i have got it working locally. Just let me know what you want the variable to actually be called if you don't want lastUpdated as this may cause confusion with some users as it is similar to the lastModified option within git. But i think these should be two separate things rather than interchangeable