From 9a9248d71f2860d3168ba212cf7db981ae0356f9 Mon Sep 17 00:00:00 2001 From: David Pang Date: Sat, 21 May 2022 20:49:35 -0400 Subject: [PATCH] feat(content-docs): add last update front matter --- .../simple-site/docs/customLastUpdate.md | 8 + .../simple-site/docs/lastUpdateAuthorOnly.md | 7 + .../simple-site/docs/lastUpdateDateOnly.md | 7 + .../__tests__/__snapshots__/docs.test.ts.snap | 55 +++++- .../__snapshots__/index.test.ts.snap | 130 ++++++++++++++ .../src/__tests__/docs.test.ts | 161 ++++++++++++++++++ .../src/__tests__/frontMatter.test.ts | 33 ++++ .../src/docs.ts | 10 ++ .../src/frontMatter.ts | 4 + .../src/plugin-content-docs.d.ts | 7 + .../_docs tests/doc-with-last-update.md | 7 + website/_dogfooding/docs-tests-sidebars.js | 1 + website/_dogfooding/dogfooding.config.js | 1 + .../docs/api/plugins/plugin-content-docs.md | 8 + 14 files changed, 434 insertions(+), 5 deletions(-) create mode 100644 packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/customLastUpdate.md create mode 100644 packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/lastUpdateAuthorOnly.md create mode 100644 packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/lastUpdateDateOnly.md create mode 100644 website/_dogfooding/_docs tests/doc-with-last-update.md diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/customLastUpdate.md b/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/customLastUpdate.md new file mode 100644 index 000000000000..b8e37d4f8a9e --- /dev/null +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/customLastUpdate.md @@ -0,0 +1,8 @@ +--- +title: Custom Last Update +last_update: + author: Custom Author + date: 1/1/2000 +--- + +Custom last update \ No newline at end of file diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/lastUpdateAuthorOnly.md b/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/lastUpdateAuthorOnly.md new file mode 100644 index 000000000000..4929ed91a9c5 --- /dev/null +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/lastUpdateAuthorOnly.md @@ -0,0 +1,7 @@ +--- +title: Last Update Author Only +last_update: + author: Custom Author +--- + +Only custom author, so it will still use the date from Git \ No newline at end of file diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/lastUpdateDateOnly.md b/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/lastUpdateDateOnly.md new file mode 100644 index 000000000000..f9bfeb9759d9 --- /dev/null +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docs/lastUpdateDateOnly.md @@ -0,0 +1,7 @@ +--- +title: Last Update Date Only +last_update: + date: 1/1/2000 +--- + +Only custom date, so it will still use the author from Git \ No newline at end of file diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/docs.test.ts.snap b/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/docs.test.ts.snap index f05c66e2aa21..69401a06a04c 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/docs.test.ts.snap +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/docs.test.ts.snap @@ -3,13 +3,24 @@ exports[`simple site custom pagination 1`] = ` { "pagination": [ + { + "id": "customLastUpdate", + "next": { + "permalink": "/docs/doc with space", + "title": "Hoo hoo, if this path tricks you...", + }, + "prev": undefined, + }, { "id": "doc with space", "next": { "permalink": "/docs/doc-draft", "title": "doc-draft", }, - "prev": undefined, + "prev": { + "permalink": "/docs/customLastUpdate", + "title": "Custom Last Update", + }, }, { "id": "doc-draft", @@ -63,14 +74,36 @@ exports[`simple site custom pagination 1`] = ` { "id": "ipsum", "next": { - "permalink": "/docs/lorem", - "title": "lorem", + "permalink": "/docs/lastUpdateAuthorOnly", + "title": "Last Update Author Only", }, "prev": { "permalink": "/docs/", "title": "Hello sidebar_label", }, }, + { + "id": "lastUpdateAuthorOnly", + "next": { + "permalink": "/docs/lastUpdateDateOnly", + "title": "Last Update Date Only", + }, + "prev": { + "permalink": "/docs/ipsum", + "title": "ipsum", + }, + }, + { + "id": "lastUpdateDateOnly", + "next": { + "permalink": "/docs/lorem", + "title": "lorem", + }, + "prev": { + "permalink": "/docs/lastUpdateAuthorOnly", + "title": "Last Update Author Only", + }, + }, { "id": "lorem", "next": { @@ -78,8 +111,8 @@ exports[`simple site custom pagination 1`] = ` "title": "rootAbsoluteSlug", }, "prev": { - "permalink": "/docs/ipsum", - "title": "ipsum", + "permalink": "/docs/lastUpdateDateOnly", + "title": "Last Update Date Only", }, }, { @@ -170,6 +203,10 @@ exports[`simple site custom pagination 1`] = ` ], "sidebars": { "defaultSidebar": [ + { + "id": "customLastUpdate", + "type": "doc", + }, { "id": "doc with space", "type": "doc", @@ -208,6 +245,14 @@ exports[`simple site custom pagination 1`] = ` "id": "ipsum", "type": "doc", }, + { + "id": "lastUpdateAuthorOnly", + "type": "doc", + }, + { + "id": "lastUpdateDateOnly", + "type": "doc", + }, { "id": "lorem", "type": "doc", diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap b/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap index c8b0408c5ee1..c428a6c55e86 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap @@ -22,6 +22,7 @@ These sidebar document ids do not exist: - nonExistent Available document ids are: +- customLastUpdate - doc with space - doc-draft - foo/bar @@ -29,6 +30,8 @@ Available document ids are: - headingAsTitle - hello - ipsum +- lastUpdateAuthorOnly +- lastUpdateDateOnly - lorem - rootAbsoluteSlug - rootRelativeSlug @@ -267,6 +270,11 @@ exports[`simple website content 5`] = ` "versions": [ { "docs": [ + { + "id": "customLastUpdate", + "path": "/docs/customLastUpdate", + "sidebar": undefined, + }, { "id": "doc with space", "path": "/docs/doc with space", @@ -302,6 +310,16 @@ exports[`simple website content 5`] = ` "path": "/docs/ipsum", "sidebar": undefined, }, + { + "id": "lastUpdateAuthorOnly", + "path": "/docs/lastUpdateAuthorOnly", + "sidebar": undefined, + }, + { + "id": "lastUpdateDateOnly", + "path": "/docs/lastUpdateDateOnly", + "sidebar": undefined, + }, { "id": "lorem", "path": "/docs/lorem", @@ -390,6 +408,26 @@ exports[`simple website content: data 1`] = ` "permalink": "/docs/rootAbsoluteSlug" } } +}", + "site-docs-custom-last-update-md-b8d.json": "{ + "unversionedId": "customLastUpdate", + "id": "customLastUpdate", + "title": "Custom Last Update", + "description": "Custom last update", + "source": "@site/docs/customLastUpdate.md", + "sourceDirName": ".", + "slug": "/customLastUpdate", + "permalink": "/docs/customLastUpdate", + "draft": false, + "tags": [], + "version": "current", + "frontMatter": { + "title": "Custom Last Update", + "last_update": { + "author": "Custom Author", + "date": "1/1/2000" + } + } }", "site-docs-doc-draft-md-584.json": "{ "unversionedId": "doc-draft", @@ -563,6 +601,44 @@ exports[`simple website content: data 1`] = ` "frontMatter": { "custom_edit_url": null } +}", + "site-docs-last-update-author-only-md-352.json": "{ + "unversionedId": "lastUpdateAuthorOnly", + "id": "lastUpdateAuthorOnly", + "title": "Last Update Author Only", + "description": "Only custom author, so it will still use the date from Git", + "source": "@site/docs/lastUpdateAuthorOnly.md", + "sourceDirName": ".", + "slug": "/lastUpdateAuthorOnly", + "permalink": "/docs/lastUpdateAuthorOnly", + "draft": false, + "tags": [], + "version": "current", + "frontMatter": { + "title": "Last Update Author Only", + "last_update": { + "author": "Custom Author" + } + } +}", + "site-docs-last-update-date-only-md-987.json": "{ + "unversionedId": "lastUpdateDateOnly", + "id": "lastUpdateDateOnly", + "title": "Last Update Date Only", + "description": "Only custom date, so it will still use the author from Git", + "source": "@site/docs/lastUpdateDateOnly.md", + "sourceDirName": ".", + "slug": "/lastUpdateDateOnly", + "permalink": "/docs/lastUpdateDateOnly", + "draft": false, + "tags": [], + "version": "current", + "frontMatter": { + "title": "Last Update Date Only", + "last_update": { + "date": "1/1/2000" + } + } }", "site-docs-lorem-md-b27.json": "{ "unversionedId": "lorem", @@ -924,6 +1000,11 @@ exports[`simple website content: data 1`] = ` ] }, "docs": { + "customLastUpdate": { + "id": "customLastUpdate", + "title": "Custom Last Update", + "description": "Custom last update" + }, "doc with space": { "id": "doc with space", "title": "Hoo hoo, if this path tricks you...", @@ -963,6 +1044,16 @@ exports[`simple website content: data 1`] = ` "title": "ipsum", "description": "Lorem ipsum." }, + "lastUpdateAuthorOnly": { + "id": "lastUpdateAuthorOnly", + "title": "Last Update Author Only", + "description": "Only custom author, so it will still use the date from Git" + }, + "lastUpdateDateOnly": { + "id": "lastUpdateDateOnly", + "title": "Last Update Date Only", + "description": "Only custom date, so it will still use the author from Git" + }, "lorem": { "id": "lorem", "title": "lorem", @@ -1026,6 +1117,11 @@ exports[`simple website content: global data 1`] = ` "versions": [ { "docs": [ + { + "id": "customLastUpdate", + "path": "/docs/customLastUpdate", + "sidebar": undefined, + }, { "id": "doc with space", "path": "/docs/doc with space", @@ -1061,6 +1157,16 @@ exports[`simple website content: global data 1`] = ` "path": "/docs/ipsum", "sidebar": undefined, }, + { + "id": "lastUpdateAuthorOnly", + "path": "/docs/lastUpdateAuthorOnly", + "sidebar": undefined, + }, + { + "id": "lastUpdateDateOnly", + "path": "/docs/lastUpdateDateOnly", + "sidebar": undefined, + }, { "id": "lorem", "path": "/docs/lorem", @@ -1202,6 +1308,14 @@ exports[`simple website content: route config 1`] = ` "path": "/docs/category/slugs", "sidebar": "docs", }, + { + "component": "@theme/DocItem", + "exact": true, + "modules": { + "content": "@site/docs/customLastUpdate.md", + }, + "path": "/docs/customLastUpdate", + }, { "component": "@theme/DocItem", "exact": true, @@ -1262,6 +1376,22 @@ exports[`simple website content: route config 1`] = ` }, "path": "/docs/ipsum", }, + { + "component": "@theme/DocItem", + "exact": true, + "modules": { + "content": "@site/docs/lastUpdateAuthorOnly.md", + }, + "path": "/docs/lastUpdateAuthorOnly", + }, + { + "component": "@theme/DocItem", + "exact": true, + "modules": { + "content": "@site/docs/lastUpdateDateOnly.md", + }, + "path": "/docs/lastUpdateDateOnly", + }, { "component": "@theme/DocItem", "exact": true, diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts index 3e0f09010925..79aae3273e84 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts @@ -230,6 +230,9 @@ describe('simple site', () => { 'headingAsTitle.md', 'doc with space.md', 'doc-draft.md', + 'customLastUpdate.md', + 'lastUpdateAuthorOnly.md', + 'lastUpdateDateOnly.md', 'foo/bar.md', 'foo/baz.md', 'slugs/absoluteSlug.md', @@ -481,6 +484,164 @@ describe('simple site', () => { }); }); + it('docs with last_update front matter', async () => { + const {siteDir, context, options, currentVersion, createTestUtilsPartial} = + await loadSite({ + options: { + showLastUpdateAuthor: true, + showLastUpdateTime: true, + }, + }); + + const testUtilsLocal = createTestUtilsPartial({ + siteDir, + context, + options, + versionMetadata: currentVersion, + }); + + await testUtilsLocal.testMeta('customLastUpdate.md', { + version: 'current', + id: 'customLastUpdate', + unversionedId: 'customLastUpdate', + sourceDirName: '.', + permalink: '/docs/customLastUpdate', + slug: '/customLastUpdate', + title: 'Custom Last Update', + description: 'Custom last update', + frontMatter: { + last_update: { + author: 'Custom Author', + date: '1/1/2000', + }, + title: 'Custom Last Update', + }, + lastUpdatedAt: new Date('1/1/2000').getTime() / 1000, + formattedLastUpdatedAt: '1/1/2000', + lastUpdatedBy: 'Custom Author', + sidebarPosition: undefined, + tags: [], + }); + }); + + it('docs with only last_update author front matter', async () => { + const {siteDir, context, options, currentVersion, createTestUtilsPartial} = + await loadSite({ + options: { + showLastUpdateAuthor: true, + showLastUpdateTime: true, + }, + }); + + const testUtilsLocal = createTestUtilsPartial({ + siteDir, + context, + options, + versionMetadata: currentVersion, + }); + + await testUtilsLocal.testMeta('lastUpdateAuthorOnly.md', { + version: 'current', + id: 'lastUpdateAuthorOnly', + unversionedId: 'lastUpdateAuthorOnly', + sourceDirName: '.', + permalink: '/docs/lastUpdateAuthorOnly', + slug: '/lastUpdateAuthorOnly', + title: 'Last Update Author Only', + description: 'Only custom author, so it will still use the date from Git', + frontMatter: { + last_update: { + author: 'Custom Author', + }, + title: 'Last Update Author Only', + }, + lastUpdatedAt: 1539502055, + formattedLastUpdatedAt: '10/14/2018', + lastUpdatedBy: 'Custom Author', + sidebarPosition: undefined, + tags: [], + }); + }); + + it('docs with only last_update date front matter', async () => { + const {siteDir, context, options, currentVersion, createTestUtilsPartial} = + await loadSite({ + options: { + showLastUpdateAuthor: true, + showLastUpdateTime: true, + }, + }); + + const testUtilsLocal = createTestUtilsPartial({ + siteDir, + context, + options, + versionMetadata: currentVersion, + }); + + await testUtilsLocal.testMeta('lastUpdateDateOnly.md', { + version: 'current', + id: 'lastUpdateDateOnly', + unversionedId: 'lastUpdateDateOnly', + sourceDirName: '.', + permalink: '/docs/lastUpdateDateOnly', + slug: '/lastUpdateDateOnly', + title: 'Last Update Date Only', + description: 'Only custom date, so it will still use the author from Git', + frontMatter: { + last_update: { + date: '1/1/2000', + }, + title: 'Last Update Date Only', + }, + lastUpdatedAt: new Date('1/1/2000').getTime() / 1000, + formattedLastUpdatedAt: '1/1/2000', + lastUpdatedBy: 'Author', + sidebarPosition: undefined, + tags: [], + }); + }); + + it('docs with last_update front matter disabled', async () => { + const {siteDir, context, options, currentVersion, createTestUtilsPartial} = + await loadSite({ + options: { + showLastUpdateAuthor: false, + showLastUpdateTime: false, + }, + }); + + const testUtilsLocal = createTestUtilsPartial({ + siteDir, + context, + options, + versionMetadata: currentVersion, + }); + + await testUtilsLocal.testMeta('customLastUpdate.md', { + version: 'current', + id: 'customLastUpdate', + unversionedId: 'customLastUpdate', + sourceDirName: '.', + permalink: '/docs/customLastUpdate', + slug: '/customLastUpdate', + title: 'Custom Last Update', + description: 'Custom last update', + frontMatter: { + last_update: { + author: 'Custom Author', + date: '1/1/2000', + }, + title: 'Custom Last Update', + }, + lastUpdatedAt: undefined, + formattedLastUpdatedAt: undefined, + lastUpdatedBy: undefined, + sidebarPosition: undefined, + tags: [], + }); + }); + it('docs with slugs', async () => { const {defaultTestUtils} = await loadSite(); diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/frontMatter.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/frontMatter.test.ts index 6612927c2d0c..b3f16057dd92 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/frontMatter.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/frontMatter.test.ts @@ -394,3 +394,36 @@ describe('validateDocFrontMatter draft', () => { ], }); }); + +describe('validateDocFrontMatter last_update', () => { + testField({ + prefix: 'last_update', + validFrontMatters: [ + {last_update: undefined}, + {last_update: {author: 'test author', date: undefined}}, + {last_update: {author: undefined, date: '1/1/2000'}}, + {last_update: {author: undefined, date: new Date('1/1/2000')}}, + {last_update: {author: 'test author', date: '1/1/2000'}}, + {last_update: {author: 'test author', date: '1995-12-17T03:24:00'}}, + {last_update: {author: undefined, date: 'December 17, 1995 03:24:00'}}, + ], + invalidFrontMatters: [ + [ + {last_update: {author: 'test author', date: 'I am not a date :('}}, + 'must be a valid date', + ], + [ + {last_update: {author: 'test author', date: '2011-10-45'}}, + 'must be a valid date', + ], + [ + {last_update: {author: 'test author', date: '2011-0-10'}}, + 'must be a valid date', + ], + [ + {last_update: {author: 'test author', date: ''}}, + 'must be a valid date', + ], + ], + }); +}); diff --git a/packages/docusaurus-plugin-content-docs/src/docs.ts b/packages/docusaurus-plugin-content-docs/src/docs.ts index 2ea127f99fbb..7a57fa1d81a4 100644 --- a/packages/docusaurus-plugin-content-docs/src/docs.ts +++ b/packages/docusaurus-plugin-content-docs/src/docs.ts @@ -155,8 +155,18 @@ function doProcessDocMetadata({ // (01-MyFolder/01-MyDoc.md => MyFolder/MyDoc) // but allow to disable this behavior with front matter parse_number_prefixes: parseNumberPrefixes = true, + last_update: lastUpdateFrontMatter, } = frontMatter; + if (lastUpdateFrontMatter?.author && options.showLastUpdateAuthor) { + lastUpdate.lastUpdatedBy = lastUpdateFrontMatter.author; + } + if (lastUpdateFrontMatter?.date && options.showLastUpdateTime) { + lastUpdate.lastUpdatedAt = + new Date(lastUpdateFrontMatter.date).getTime() / 1000; + lastUpdate.formattedLastUpdatedAt = undefined; + } + // E.g. api/plugins/myDoc -> myDoc; myDoc -> myDoc const sourceFileNameWithoutExtension = path.basename( source, diff --git a/packages/docusaurus-plugin-content-docs/src/frontMatter.ts b/packages/docusaurus-plugin-content-docs/src/frontMatter.ts index de944a6b1716..ade1810455eb 100644 --- a/packages/docusaurus-plugin-content-docs/src/frontMatter.ts +++ b/packages/docusaurus-plugin-content-docs/src/frontMatter.ts @@ -42,6 +42,10 @@ const DocFrontMatterSchema = Joi.object({ pagination_prev: Joi.string().allow(null), draft: Joi.boolean(), ...FrontMatterTOCHeadingLevels, + last_update: Joi.object({ + author: Joi.string(), + date: Joi.date().raw(), + }), }).unknown(); export function validateDocFrontMatter(frontMatter: { diff --git a/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts b/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts index 1d7784c63fc7..7c0fb61cefc5 100644 --- a/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts +++ b/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts @@ -23,6 +23,11 @@ declare module '@docusaurus/plugin-content-docs' { image?: string; }; + export type FileChange = { + author?: string; + date?: Date | string; + }; + /** * Custom callback for parsing number prefixes from file/folder names. */ @@ -356,6 +361,8 @@ declare module '@docusaurus/plugin-content-docs' { pagination_prev?: string | null; /** Should this doc be excluded from production builds? */ draft?: boolean; + /** Front matter override for last update to doc */ + last_update?: FileChange; }; export type LastUpdateData = { diff --git a/website/_dogfooding/_docs tests/doc-with-last-update.md b/website/_dogfooding/_docs tests/doc-with-last-update.md new file mode 100644 index 000000000000..34c1cb0c7cb6 --- /dev/null +++ b/website/_dogfooding/_docs tests/doc-with-last-update.md @@ -0,0 +1,7 @@ +--- +last_update: + author: custom author + date: 1/1/2000 +--- + +# Doc With Last Update Front Matter diff --git a/website/_dogfooding/docs-tests-sidebars.js b/website/_dogfooding/docs-tests-sidebars.js index 6b8b8f9c4365..0183dbb53925 100644 --- a/website/_dogfooding/docs-tests-sidebars.js +++ b/website/_dogfooding/docs-tests-sidebars.js @@ -17,6 +17,7 @@ const sidebars = { 'test-draft', 'doc-without-sidebar', 'doc-with-another-sidebar', + 'doc-with-last-update', { type: 'category', label: 'Tests', diff --git a/website/_dogfooding/dogfooding.config.js b/website/_dogfooding/dogfooding.config.js index 95c1d5161843..bafce78b219f 100644 --- a/website/_dogfooding/dogfooding.config.js +++ b/website/_dogfooding/dogfooding.config.js @@ -34,6 +34,7 @@ const dogfoodingPluginInstances = [ // eslint-disable-next-line no-restricted-properties path: fs.realpathSync('_dogfooding/docs-tests-symlink'), showLastUpdateTime: true, + showLastUpdateAuthor: true, sidebarItemsGenerator(args) { return args.defaultSidebarItemsGenerator({ ...args, diff --git a/website/docs/api/plugins/plugin-content-docs.md b/website/docs/api/plugins/plugin-content-docs.md index e5971ee2fa59..95d3cee68d03 100644 --- a/website/docs/api/plugins/plugin-content-docs.md +++ b/website/docs/api/plugins/plugin-content-docs.md @@ -263,6 +263,7 @@ Accepted fields: | `slug` | `string` | File path | Allows to customize the document url (`//`). Support multiple patterns: `slug: my-doc`, `slug: /my/path/myDoc`, `slug: /`. | | `tags` | `Tag[]` | `undefined` | A list of strings or objects of two string fields `label` and `permalink` to tag to your docs. | | `draft` | `boolean` | `false` | A boolean flag to indicate that a document is a work-in-progress. Draft documents will only be displayed during development. | +| `last_update` | `FileChange` | `undefined` | Allows overriding the last updated author and/or date. Date can be any [parsable date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse). | @@ -270,6 +271,10 @@ Accepted fields: type Tag = string | {label: string; permalink: string}; ``` +```ts +type FileChange = {date: string; author: string}; +``` + Example: ```md @@ -288,6 +293,9 @@ keywords: - docusaurus image: https://i.imgur.com/mErPwqL.png slug: /myDoc +last_update: + date: 1/1/2000 + author: custom author name --- # Markdown Features