mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-13 09:07:29 +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
|
slug: bazSlug.html
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# Baz markdown title
|
||||||
|
|
||||||
## Images
|
## Images
|
||||||
|
|
||||||
Like links, Images also have a footnote style syntax
|
Like links, Images also have a footnote style syntax
|
||||||
|
|
|
@ -190,7 +190,7 @@ Object {
|
||||||
\\"unversionedId\\": \\"foo/baz\\",
|
\\"unversionedId\\": \\"foo/baz\\",
|
||||||
\\"id\\": \\"foo/baz\\",
|
\\"id\\": \\"foo/baz\\",
|
||||||
\\"isDocsHomePage\\": false,
|
\\"isDocsHomePage\\": false,
|
||||||
\\"title\\": \\"baz\\",
|
\\"title\\": \\"Baz markdown title\\",
|
||||||
\\"description\\": \\"Images\\",
|
\\"description\\": \\"Images\\",
|
||||||
\\"source\\": \\"@site/docs/foo/baz.md\\",
|
\\"source\\": \\"@site/docs/foo/baz.md\\",
|
||||||
\\"sourceDirName\\": \\"foo\\",
|
\\"sourceDirName\\": \\"foo\\",
|
||||||
|
@ -204,7 +204,7 @@ Object {
|
||||||
},
|
},
|
||||||
\\"sidebar\\": \\"docs\\",
|
\\"sidebar\\": \\"docs\\",
|
||||||
\\"previous\\": {
|
\\"previous\\": {
|
||||||
\\"title\\": \\"Remarkable\\",
|
\\"title\\": \\"Bar\\",
|
||||||
\\"permalink\\": \\"/docs/foo/bar\\"
|
\\"permalink\\": \\"/docs/foo/bar\\"
|
||||||
},
|
},
|
||||||
\\"next\\": {
|
\\"next\\": {
|
||||||
|
@ -423,7 +423,7 @@ Object {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
\\"type\\": \\"link\\",
|
\\"type\\": \\"link\\",
|
||||||
\\"label\\": \\"baz\\",
|
\\"label\\": \\"Baz markdown title\\",
|
||||||
\\"href\\": \\"/docs/foo/bazSlug.html\\"
|
\\"href\\": \\"/docs/foo/bazSlug.html\\"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -286,7 +286,7 @@ describe('simple site', () => {
|
||||||
isDocsHomePage: false,
|
isDocsHomePage: false,
|
||||||
permalink: '/docs/foo/bazSlug.html',
|
permalink: '/docs/foo/bazSlug.html',
|
||||||
slug: '/foo/bazSlug.html',
|
slug: '/foo/bazSlug.html',
|
||||||
title: 'baz',
|
title: 'Baz markdown title',
|
||||||
editUrl:
|
editUrl:
|
||||||
'https://github.com/facebook/docusaurus/edit/master/website/docs/foo/baz.md',
|
'https://github.com/facebook/docusaurus/edit/master/website/docs/foo/baz.md',
|
||||||
description: 'Images',
|
description: 'Images',
|
||||||
|
@ -345,7 +345,7 @@ describe('simple site', () => {
|
||||||
isDocsHomePage: false,
|
isDocsHomePage: false,
|
||||||
permalink: '/docs/foo/bazSlug.html',
|
permalink: '/docs/foo/bazSlug.html',
|
||||||
slug: '/foo/bazSlug.html',
|
slug: '/foo/bazSlug.html',
|
||||||
title: 'baz',
|
title: 'Baz markdown title',
|
||||||
editUrl: hardcodedEditUrl,
|
editUrl: hardcodedEditUrl,
|
||||||
description: 'Images',
|
description: 'Images',
|
||||||
frontMatter: {
|
frontMatter: {
|
||||||
|
|
|
@ -199,7 +199,11 @@ export default function pluginContentDocs(
|
||||||
nextId,
|
nextId,
|
||||||
} = sidebarsUtils.getDocNavigation(doc.id);
|
} = sidebarsUtils.getDocNavigation(doc.id);
|
||||||
const toDocNavLink = (navDocId: string): DocNavLink => ({
|
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,
|
permalink: docsBaseById[navDocId].permalink,
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue