mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-16 18:46:57 +02:00
fix(content-docs): sidebar generator should return customProps for doc items (#9107)
This commit is contained in:
parent
05156d05b9
commit
9391a33c41
3 changed files with 10 additions and 1 deletions
|
@ -86,6 +86,9 @@ exports[`DefaultSidebarItemsGenerator generates simple flat sidebar 1`] = `
|
|||
"type": "doc",
|
||||
},
|
||||
{
|
||||
"customProps": {
|
||||
"custom": "prop",
|
||||
},
|
||||
"id": "doc1",
|
||||
"label": "doc1 sidebar label",
|
||||
"type": "doc",
|
||||
|
|
|
@ -64,6 +64,7 @@ describe('DefaultSidebarItemsGenerator', () => {
|
|||
sidebarPosition: 2,
|
||||
frontMatter: {
|
||||
sidebar_label: 'doc1 sidebar label',
|
||||
sidebar_custom_props: {custom: 'prop'},
|
||||
},
|
||||
title: '',
|
||||
unversionedId: 'doc1',
|
||||
|
|
|
@ -138,7 +138,11 @@ Available doc IDs:
|
|||
): WithPosition<SidebarItemDoc> {
|
||||
const {
|
||||
sidebarPosition: position,
|
||||
frontMatter: {sidebar_label: label, sidebar_class_name: className},
|
||||
frontMatter: {
|
||||
sidebar_label: label,
|
||||
sidebar_class_name: className,
|
||||
sidebar_custom_props: customProps,
|
||||
},
|
||||
} = getDoc(id);
|
||||
return {
|
||||
type: 'doc',
|
||||
|
@ -149,6 +153,7 @@ Available doc IDs:
|
|||
// sidebar
|
||||
...(label !== undefined && {label}),
|
||||
...(className !== undefined && {className}),
|
||||
...(customProps !== undefined && {customProps}),
|
||||
};
|
||||
}
|
||||
function createCategoryItem(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue