Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ exports[`DefaultSidebarItemsGenerator generates simple flat sidebar 1`] = `
"type": "doc",
},
{
"customProps": {
"custom": "prop",
},
"id": "doc1",
"label": "doc1 sidebar label",
"type": "doc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 2,
frontMatter: {
sidebar_label: 'doc1 sidebar label',
sidebar_custom_props: {custom: 'prop'},
},
title: '',
unversionedId: 'doc1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -149,6 +153,7 @@ Available doc IDs:
// sidebar
...(label !== undefined && {label}),
...(className !== undefined && {className}),
...(customProps !== undefined && {customProps}),
};
}
function createCategoryItem(
Expand Down