From cc53b35f7e0306ba91df05102724174ee6aa48b3 Mon Sep 17 00:00:00 2001 From: SHIBAHARA Hiroki Date: Mon, 7 Oct 2024 23:19:57 +0900 Subject: [PATCH] fix: The category name is displayed with Lower case in JumpTo Sidebar on Example Detail page. --- src/pages/_utils.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/_utils.ts b/src/pages/_utils.ts index 14ef5874ae..6c7bd78fdf 100644 --- a/src/pages/_utils.ts +++ b/src/pages/_utils.ts @@ -339,7 +339,7 @@ export const generateJumpToState = async ( break; case "examples": categories = new Set( - localeEntries.map((entry) => getExampleCategory(entry.slug)), + localeEntries.map((entry) => getExampleCategory(entry.id)), ); break; default: @@ -374,14 +374,15 @@ export const generateJumpToState = async ( // Examples are a special case where subentries are only shown if they are in the current category if ( collectionType !== "examples" || - category === getExampleCategory(currentEntrySlug) + category === getExampleCategory(currentEntrySlug) || + category.toLowerCase() === getExampleCategory(currentEntrySlug) ) { // Get all entries in the current category let currentCategoryEntries = localeEntries.filter( (entry) => category === (collectionType === "examples" - ? getExampleCategory(entry.slug) + ? getExampleCategory(entry.id) : // @ts-expect-error - We know that the category exists because of the collection type entry.data.category ?? ""), );