mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 02:08:55 +02:00
feat(content-docs): allow custom props through _category_.json (#6780)
* feat(content-docs): allow custom props through _category_.json * refactor * documentation Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
parent
b2d6e453e3
commit
2e163a9ec4
5 changed files with 18 additions and 1 deletions
|
@ -159,6 +159,7 @@ export const DefaultSidebarItemsGenerator: SidebarItemsGenerator = async ({
|
|||
const categoryMetadata =
|
||||
categoriesMetadata[posixPath(path.join(autogenDir, fullPath))];
|
||||
const className = categoryMetadata?.className;
|
||||
const customProps = categoryMetadata?.customProps;
|
||||
const {filename, numberPrefix} = numberPrefixParser(folderName);
|
||||
const allItems = Object.entries(dir).map(([key, content]) =>
|
||||
dirToItem(content, key, `${fullPath}/${key}`),
|
||||
|
@ -219,6 +220,7 @@ export const DefaultSidebarItemsGenerator: SidebarItemsGenerator = async ({
|
|||
collapsed: categoryMetadata?.collapsed,
|
||||
position: categoryMetadata?.position ?? numberPrefix,
|
||||
source: folderName,
|
||||
...(customProps !== undefined && {customProps}),
|
||||
...(className !== undefined && {className}),
|
||||
items,
|
||||
...(link && {link}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue