fix(v2): sidebar_label should be used to compute next/previous button labels (#4970)

* sidebar_label should be used to compute next/previous button texts, as documented.

* improve docs frontmatter doc

* use a little bit of destructuring
This commit is contained in:
Sébastien Lorber 2021-06-15 12:04:29 +02:00 committed by GitHub
parent aeb8e9da51
commit 737f80a026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 75 additions and 38 deletions

View file

@ -198,10 +198,13 @@ export default function pluginContentDocs(
previousId,
nextId,
} = sidebarsUtils.getDocNavigation(doc.id);
const toDocNavLink = (navDocId: string): DocNavLink => ({
title: docsBaseById[navDocId].title,
permalink: docsBaseById[navDocId].permalink,
});
const toDocNavLink = (navDocId: string): DocNavLink => {
const {title, permalink, frontMatter} = docsBaseById[navDocId];
return {
title: frontMatter.sidebar_label ?? title,
permalink,
};
};
return {
...doc,
sidebar: sidebarName,