mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-29 06:29:03 +02:00
feat(v2): provide doc sidebar_label through sidebars.js (#4500)
* feat : update SidebarItemDoc type * feat : update assertIsDoc * feat : allow configuring title from sidebar.js * feat : add docs * docs : refactor i18n docs to use label in sidebar.js * test : add test * Update website/docs/guides/docs/sidebar.md Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> * docs : remove backported docs Co-authored-by: Lisa Chandra <52909743+lisa761@users.noreply.github.com> Co-authored-by: Javid <singularity.javid@gmail.com> Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
This commit is contained in:
parent
f7614081dd
commit
9715048f79
14 changed files with 111 additions and 11 deletions
|
@ -118,12 +118,18 @@ function assertIsCategory(
|
|||
function assertIsDoc(
|
||||
item: Record<string, unknown>,
|
||||
): asserts item is SidebarItemDoc {
|
||||
assertItem(item, ['id', 'customProps']);
|
||||
assertItem(item, ['id', 'label', 'customProps']);
|
||||
if (typeof item.id !== 'string') {
|
||||
throw new Error(
|
||||
`Error loading ${JSON.stringify(item)}. "id" must be a string.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (item.label && typeof item.label !== 'string') {
|
||||
throw new Error(
|
||||
`Error loading ${JSON.stringify(item)}. "label" must be a string.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function assertIsLink(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue