Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export type SidebarItemLink = SidebarItemBase & {
href: string;
label: string;
autoAddBaseUrl?: boolean;
description?: string;
};

export type SidebarItemAutogenerated = SidebarItemBase & {
Expand All @@ -69,6 +70,7 @@ export type SidebarItemCategoryLinkGeneratedIndexConfig = {
image?: string;
keywords?: string | readonly string[];
};

export type SidebarItemCategoryLinkGeneratedIndex = {
type: 'generated-index';
slug: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ function CardLink({item}: {item: PropSidebarItemLink}): JSX.Element {
href={item.href}
icon={icon}
title={item.label}
description={doc?.description}
description={
isInternalUrl(item.href) ? doc?.description : item.description
}
/>
);
}
Expand Down
6 changes: 6 additions & 0 deletions website/_dogfooding/docs-tests-sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ const sidebars = {
label: 'External Link test',
href: 'https://docusaurus.io',
},
{
type: 'link',
label: 'External Link with description',
href: 'https://docusaurus.io',
description: 'Some description',
},
],
},
{
Expand Down