mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +02:00
feat(content-docs): add support for sidebar item category/link descriptions in generated index page (#8236)
Co-authored-by: Davide Donadio <davide.donadio@it.clara.net> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
ca86fab2c9
commit
5c271f5622
6 changed files with 67 additions and 11 deletions
|
@ -45,6 +45,7 @@ export type SidebarItemLink = SidebarItemBase & {
|
|||
href: string;
|
||||
label: string;
|
||||
autoAddBaseUrl?: boolean;
|
||||
description?: string;
|
||||
};
|
||||
|
||||
export type SidebarItemAutogenerated = SidebarItemBase & {
|
||||
|
@ -57,6 +58,7 @@ type SidebarItemCategoryBase = SidebarItemBase & {
|
|||
label: string;
|
||||
collapsed: boolean;
|
||||
collapsible: boolean;
|
||||
description?: string;
|
||||
};
|
||||
|
||||
export type SidebarItemCategoryLinkDoc = {type: 'doc'; id: string};
|
||||
|
|
|
@ -63,6 +63,9 @@ const sidebarItemLinkSchema = sidebarItemBaseSchema.append<SidebarItemLink>({
|
|||
label: Joi.string()
|
||||
.required()
|
||||
.messages({'any.unknown': '"label" must be a string'}),
|
||||
description: Joi.string().optional().messages({
|
||||
'any.unknown': '"description" must be a string',
|
||||
}),
|
||||
});
|
||||
|
||||
const sidebarItemCategoryLinkSchema = Joi.object<SidebarItemCategoryLink>()
|
||||
|
@ -116,6 +119,9 @@ const sidebarItemCategorySchema =
|
|||
collapsible: Joi.boolean().messages({
|
||||
'any.unknown': '"collapsible" must be a boolean',
|
||||
}),
|
||||
description: Joi.string().optional().messages({
|
||||
'any.unknown': '"description" must be a string',
|
||||
}),
|
||||
});
|
||||
|
||||
const sidebarItemSchema = Joi.object<SidebarItemConfig>().when('.type', {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue