mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +02:00
fix(v2): use frontmatter title at first for paginated links (#4859)
This commit is contained in:
parent
08b94580e9
commit
0417ab9532
4 changed files with 12 additions and 6 deletions
|
@ -4,6 +4,8 @@ title: baz
|
|||
slug: bazSlug.html
|
||||
---
|
||||
|
||||
# Baz markdown title
|
||||
|
||||
## Images
|
||||
|
||||
Like links, Images also have a footnote style syntax
|
||||
|
|
|
@ -190,7 +190,7 @@ Object {
|
|||
\\"unversionedId\\": \\"foo/baz\\",
|
||||
\\"id\\": \\"foo/baz\\",
|
||||
\\"isDocsHomePage\\": false,
|
||||
\\"title\\": \\"baz\\",
|
||||
\\"title\\": \\"Baz markdown title\\",
|
||||
\\"description\\": \\"Images\\",
|
||||
\\"source\\": \\"@site/docs/foo/baz.md\\",
|
||||
\\"sourceDirName\\": \\"foo\\",
|
||||
|
@ -204,7 +204,7 @@ Object {
|
|||
},
|
||||
\\"sidebar\\": \\"docs\\",
|
||||
\\"previous\\": {
|
||||
\\"title\\": \\"Remarkable\\",
|
||||
\\"title\\": \\"Bar\\",
|
||||
\\"permalink\\": \\"/docs/foo/bar\\"
|
||||
},
|
||||
\\"next\\": {
|
||||
|
@ -423,7 +423,7 @@ Object {
|
|||
},
|
||||
{
|
||||
\\"type\\": \\"link\\",
|
||||
\\"label\\": \\"baz\\",
|
||||
\\"label\\": \\"Baz markdown title\\",
|
||||
\\"href\\": \\"/docs/foo/bazSlug.html\\"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -286,7 +286,7 @@ describe('simple site', () => {
|
|||
isDocsHomePage: false,
|
||||
permalink: '/docs/foo/bazSlug.html',
|
||||
slug: '/foo/bazSlug.html',
|
||||
title: 'baz',
|
||||
title: 'Baz markdown title',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs/foo/baz.md',
|
||||
description: 'Images',
|
||||
|
@ -345,7 +345,7 @@ describe('simple site', () => {
|
|||
isDocsHomePage: false,
|
||||
permalink: '/docs/foo/bazSlug.html',
|
||||
slug: '/foo/bazSlug.html',
|
||||
title: 'baz',
|
||||
title: 'Baz markdown title',
|
||||
editUrl: hardcodedEditUrl,
|
||||
description: 'Images',
|
||||
frontMatter: {
|
||||
|
|
|
@ -199,7 +199,11 @@ export default function pluginContentDocs(
|
|||
nextId,
|
||||
} = sidebarsUtils.getDocNavigation(doc.id);
|
||||
const toDocNavLink = (navDocId: string): DocNavLink => ({
|
||||
title: docsBaseById[navDocId].title,
|
||||
// Use frontMatter.title in priority over a potential # title found in markdown
|
||||
// See https://github.com/facebook/docusaurus/issues/4665#issuecomment-825831367
|
||||
title:
|
||||
docsBaseById[navDocId].frontMatter.title ||
|
||||
docsBaseById[navDocId].title,
|
||||
permalink: docsBaseById[navDocId].permalink,
|
||||
});
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue