Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -217,6 +217,7 @@ exports[`DefaultSidebarItemsGenerator uses explicit link over the index/readme.{
{
"collapsed": undefined,
"collapsible": undefined,
"description": "Category description",
"items": [
{
"id": "parent/doc2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ describe('DefaultSidebarItemsGenerator', () => {
categoriesMetadata: {
Category: {
label: 'Category label',
description: 'Category description',
link: {
type: 'doc',
id: 'doc3', // Using a "local doc id" ("doc1" instead of "parent/doc1") on purpose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ describe('validateCategoryMetadataFile', () => {
const content: CategoryMetadataFile = {
className: 'className',
label: 'Category Label',
description: 'Category Description',
link: {
type: 'generated-index',
slug: 'slug',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ Available doc IDs:
...(customProps !== undefined && {customProps}),
...(className !== undefined && {className}),
items,
...(categoryMetadata?.description && {
description: categoryMetadata?.description,
}),
...(link && {link}),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function postProcessSidebarItem(
.map((subItem) => postProcessSidebarItem(subItem, params))
.filter((v): v is SidebarItem => Boolean(v)),
};

// If the current category doesn't have subitems, we render a normal link
// instead.
if (category.items.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export type PropSidebarBreadcrumbsItem =
export type CategoryMetadataFile = {
label?: string;
position?: number;
description?: string;
collapsed?: boolean;
collapsible?: boolean;
className?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export function validateSidebars(sidebars: {

const categoryMetadataFileSchema = Joi.object<CategoryMetadataFile>({
label: Joi.string(),
description: Joi.string(),
position: Joi.number(),
collapsed: Joi.boolean(),
collapsible: Joi.boolean(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"label": "Category Links",
"description": "Category Links - Custom Description",
"link": {
"type": "generated-index",
"slug": "/category-links-generated-index-slug"
Expand Down
1 change: 1 addition & 0 deletions website/_dogfooding/docs-tests-sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const sidebars = {
{
type: 'category',
label: 'Sidebar item description tests',
description: 'Some custom category description',
link: {
type: 'generated-index',
},
Expand Down