From c958dfeb736c6e7f81aea90e7d128249cdcd4ae4 Mon Sep 17 00:00:00 2001 From: phvm Date: Mon, 14 Oct 2024 11:52:28 -0300 Subject: [PATCH] fix: breadcrumb type --- src/pages/docs/tracks/[slug].tsx | 3 ++- src/utils/getBreadcrumbsList.ts | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/docs/tracks/[slug].tsx b/src/pages/docs/tracks/[slug].tsx index e843791e..124908b1 100644 --- a/src/pages/docs/tracks/[slug].tsx +++ b/src/pages/docs/tracks/[slug].tsx @@ -429,7 +429,8 @@ export const getStaticProps: GetStaticProps = async ({ parentsArray, parentsArrayName, parentsArrayType, - 'tracks' + 'tracks', + locale ) return { diff --git a/src/utils/getBreadcrumbsList.ts b/src/utils/getBreadcrumbsList.ts index efc3f176..564cfc8b 100644 --- a/src/utils/getBreadcrumbsList.ts +++ b/src/utils/getBreadcrumbsList.ts @@ -2,14 +2,15 @@ export function getBreadcrumbsList( parents: string[], parentsNames: string[], parentsTypes: string[], - docsType: 'tutorial' | 'tracks' + docsType: 'tutorial' | 'tracks', + locale?: string ) { const breadcrumbs: { slug: string; name: string; type: string }[] = [] parentsNames.forEach((_el: string, idx: number) => { breadcrumbs.push({ - slug: `/docs/${docsType}/${parents[idx]}`, + slug: `${locale}/docs/${docsType}/${parents[idx]}`, name: parentsNames[idx], - type: parentsTypes[idx], + type: parentsTypes[idx] || 'defaultType', }) }) return breadcrumbs