mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-04 01:09:20 +02:00
feat(content-docs): last_update front matter (#7461)
Co-authored-by: Joshua Chen <sidachen2003@gmail.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
a469ae3d63
commit
4f26a1911a
15 changed files with 499 additions and 36 deletions
7
website/_dogfooding/_docs tests/doc-with-last-update.md
Normal file
7
website/_dogfooding/_docs tests/doc-with-last-update.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
last_update:
|
||||
author: custom author
|
||||
date: 1/1/2000
|
||||
---
|
||||
|
||||
# Doc With Last Update Front Matter
|
|
@ -22,6 +22,7 @@ const sidebars = {
|
|||
'test-draft',
|
||||
'doc-without-sidebar',
|
||||
'doc-with-another-sidebar',
|
||||
'doc-with-last-update',
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Tests',
|
||||
|
|
|
@ -30,6 +30,7 @@ const dogfoodingPluginInstances = [
|
|||
// Using a _ prefix to test against an edge case regarding MDX partials: https://github.com/facebook/docusaurus/discussions/5181#discussioncomment-1018079
|
||||
path: '_dogfooding/_docs tests',
|
||||
showLastUpdateTime: true,
|
||||
showLastUpdateAuthor: true,
|
||||
sidebarItemsGenerator(args) {
|
||||
return args.defaultSidebarItemsGenerator({
|
||||
...args,
|
||||
|
|
|
@ -281,6 +281,7 @@ Accepted fields:
|
|||
| `slug` | `string` | File path | Allows to customize the document url (`/<routeBasePath>/<slug>`). 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). |
|
||||
|
||||
</APITable>
|
||||
|
||||
|
@ -288,6 +289,10 @@ Accepted fields:
|
|||
type Tag = string | {label: string; permalink: string};
|
||||
```
|
||||
|
||||
```ts
|
||||
type FileChange = {date: string; author: string};
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```md
|
||||
|
@ -306,6 +311,9 @@ keywords:
|
|||
- docusaurus
|
||||
image: https://i.imgur.com/mErPwqL.png
|
||||
slug: /myDoc
|
||||
last_update:
|
||||
date: 1/1/2000
|
||||
author: custom author name
|
||||
---
|
||||
|
||||
# Markdown Features
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue