fix(docs): sidebar item label impact the pagination label of docs (#10025)

Co-authored-by: sebastien <lorber.sebastien@gmail.com>
This commit is contained in:
Abdullah Saud 2024-04-11 21:26:11 +05:00 committed by GitHub
parent 721f14537d
commit e4ecffe418
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 46 additions and 3 deletions

View file

@ -478,7 +478,10 @@ Available document ids are:
};
}
export function toDocNavigationLink(doc: DocMetadataBase): PropNavigationLink {
export function toDocNavigationLink(
doc: DocMetadataBase,
options?: {sidebarItemLabel?: string | undefined},
): PropNavigationLink {
const {
title,
permalink,
@ -487,7 +490,11 @@ export function toDocNavigationLink(doc: DocMetadataBase): PropNavigationLink {
sidebar_label: sidebarLabel,
},
} = doc;
return {title: paginationLabel ?? sidebarLabel ?? title, permalink};
return {
title:
paginationLabel ?? sidebarLabel ?? options?.sidebarItemLabel ?? title,
permalink,
};
}
export function toNavigationLink(
@ -516,5 +523,7 @@ export function toNavigationLink(
permalink: navigationItem.link.permalink,
};
}
return toDocNavigationLink(getDocById(navigationItem.id));
return toDocNavigationLink(getDocById(navigationItem.id), {
sidebarItemLabel: navigationItem?.label,
});
}