feat(content-docs): allow explicitly disabling index page for generated category (#6452)

* feat(content-docs): allow explicitly disabling index page for generated category

* docs

* add test
This commit is contained in:
Joshua Chen 2022-01-27 23:14:07 +08:00 committed by GitHub
parent ffa108b58b
commit 3c58d7f027
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 3 deletions

View file

@ -416,6 +416,10 @@ describe('DefaultSidebarItemsGenerator', () => {
id: 'doc3', // Using a "local doc id" ("doc1" instead of "parent/doc1") on purpose
},
},
'Category2/_category_.yml': {
label: 'Category 2 label',
link: null,
},
});
const sidebarSlice = await DefaultSidebarItemsGenerator({
@ -447,6 +451,24 @@ describe('DefaultSidebarItemsGenerator', () => {
sourceDirName: 'Category',
frontMatter: {},
},
{
id: 'parent/doc4',
source: '@site/docs/Category2/doc1.md',
sourceDirName: 'Category2',
frontMatter: {},
},
{
id: 'parent/doc5',
source: '@site/docs/Category2/index.md',
sourceDirName: 'Category2',
frontMatter: {},
},
{
id: 'parent/doc6',
source: '@site/docs/Category2/doc3.md',
sourceDirName: 'Category2',
frontMatter: {},
},
],
options: {
sidebarCollapsed: true,
@ -475,6 +497,26 @@ describe('DefaultSidebarItemsGenerator', () => {
},
],
},
{
type: 'category',
label: 'Category 2 label',
collapsed: true,
collapsible: true,
items: [
{
id: 'parent/doc4',
type: 'doc',
},
{
id: 'parent/doc5',
type: 'doc',
},
{
id: 'parent/doc6',
type: 'doc',
},
],
},
] as Sidebar);
});