mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
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:
parent
ffa108b58b
commit
3c58d7f027
7 changed files with 57 additions and 3 deletions
|
@ -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);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue