mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
feat(v2): add docs pagination_label frontmatter (#4982)
* feat(v2): add docs pagination_label frontmatter * feat(v2): add docs pagination_label frontmatter * feat(v2): add docs pagination_label frontmatter
This commit is contained in:
parent
41d9288e3d
commit
32e76f1cc0
8 changed files with 25 additions and 10 deletions
|
@ -2,6 +2,7 @@
|
|||
id: baz
|
||||
title: baz
|
||||
slug: bazSlug.html
|
||||
pagination_label: baz pagination_label
|
||||
---
|
||||
|
||||
# Baz markdown title
|
||||
|
@ -36,7 +37,7 @@ Duplicated footnote reference[^second].
|
|||
|
||||
[^first]: Footnote **can have markup**
|
||||
|
||||
and multiple paragraphs.
|
||||
and multiple paragraphs.
|
||||
|
||||
[^second]: Footnote text.
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ Object {
|
|||
},
|
||||
\\"sidebar\\": \\"docs\\",
|
||||
\\"next\\": {
|
||||
\\"title\\": \\"baz\\",
|
||||
\\"title\\": \\"baz pagination_label\\",
|
||||
\\"permalink\\": \\"/docs/foo/bazSlug.html\\"
|
||||
}
|
||||
}",
|
||||
|
@ -200,7 +200,8 @@ Object {
|
|||
\\"frontMatter\\": {
|
||||
\\"id\\": \\"baz\\",
|
||||
\\"title\\": \\"baz\\",
|
||||
\\"slug\\": \\"bazSlug.html\\"
|
||||
\\"slug\\": \\"bazSlug.html\\",
|
||||
\\"pagination_label\\": \\"baz pagination_label\\"
|
||||
},
|
||||
\\"sidebar\\": \\"docs\\",
|
||||
\\"previous\\": {
|
||||
|
@ -243,7 +244,7 @@ Object {
|
|||
},
|
||||
\\"sidebar\\": \\"docs\\",
|
||||
\\"previous\\": {
|
||||
\\"title\\": \\"baz\\",
|
||||
\\"title\\": \\"baz pagination_label\\",
|
||||
\\"permalink\\": \\"/docs/foo/bazSlug.html\\"
|
||||
}
|
||||
}",
|
||||
|
|
|
@ -296,6 +296,7 @@ describe('simple site', () => {
|
|||
id: 'baz',
|
||||
slug: 'bazSlug.html',
|
||||
title: 'baz',
|
||||
pagination_label: 'baz pagination_label',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -354,6 +355,7 @@ describe('simple site', () => {
|
|||
id: 'baz',
|
||||
slug: 'bazSlug.html',
|
||||
title: 'baz',
|
||||
pagination_label: 'baz pagination_label',
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -360,6 +360,7 @@ describe('simple website', () => {
|
|||
id: 'baz',
|
||||
title: 'baz',
|
||||
slug: 'bazSlug.html',
|
||||
pagination_label: 'baz pagination_label',
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -373,7 +374,7 @@ describe('simple website', () => {
|
|||
permalink: '/docs/',
|
||||
slug: '/',
|
||||
previous: {
|
||||
title: 'baz',
|
||||
title: 'baz pagination_label',
|
||||
permalink: '/docs/foo/bazSlug.html',
|
||||
},
|
||||
sidebar: 'docs',
|
||||
|
@ -399,7 +400,7 @@ describe('simple website', () => {
|
|||
sourceDirName: 'foo',
|
||||
isDocsHomePage: false,
|
||||
next: {
|
||||
title: 'baz',
|
||||
title: 'baz pagination_label',
|
||||
permalink: '/docs/foo/bazSlug.html',
|
||||
},
|
||||
permalink: '/docs/foo/bar',
|
||||
|
|
|
@ -28,6 +28,7 @@ const DocFrontMatterSchema = Joi.object<DocFrontMatter>({
|
|||
slug: Joi.string(),
|
||||
sidebar_label: Joi.string(),
|
||||
sidebar_position: Joi.number().min(0),
|
||||
pagination_label: Joi.string(),
|
||||
custom_edit_url: Joi.string().uri({allowRelative: true}).allow('', null),
|
||||
parse_number_prefixes: Joi.boolean(),
|
||||
}).unknown();
|
||||
|
|
|
@ -204,7 +204,10 @@ export default function pluginContentDocs(
|
|||
const toDocNavLink = (navDocId: string): DocNavLink => {
|
||||
const {title, permalink, frontMatter} = docsBaseById[navDocId];
|
||||
return {
|
||||
title: frontMatter.sidebar_label ?? title,
|
||||
title:
|
||||
frontMatter.pagination_label ??
|
||||
frontMatter.sidebar_label ??
|
||||
title,
|
||||
permalink,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -192,6 +192,7 @@ export type DocFrontMatter = {
|
|||
slug?: string;
|
||||
sidebar_label?: string;
|
||||
sidebar_position?: number;
|
||||
pagination_label?: string;
|
||||
custom_edit_url?: string | null;
|
||||
parse_number_prefixes?: boolean;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue