fix(content-docs): sidebar generator should return customProps for doc items (#9107)

This commit is contained in:
TheCatLady 2023-06-29 03:13:48 -07:00 committed by GitHub
parent 05156d05b9
commit 9391a33c41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View file

@ -86,6 +86,9 @@ exports[`DefaultSidebarItemsGenerator generates simple flat sidebar 1`] = `
"type": "doc",
},
{
"customProps": {
"custom": "prop",
},
"id": "doc1",
"label": "doc1 sidebar label",
"type": "doc",

View file

@ -64,6 +64,7 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 2,
frontMatter: {
sidebar_label: 'doc1 sidebar label',
sidebar_custom_props: {custom: 'prop'},
},
title: '',
unversionedId: 'doc1',

View file

@ -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(