From 39f11640e21851dbb72744a06ef017febbe3c75f Mon Sep 17 00:00:00 2001 From: Borghild Selle <104756130+BorghildSelle@users.noreply.github.com> Date: Thu, 16 Jan 2025 09:57:22 +0100 Subject: [PATCH] :bug: fix breadcrumbs (#2750) --- web/core/Breadcrumbs/Breadcrumbs.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/web/core/Breadcrumbs/Breadcrumbs.tsx b/web/core/Breadcrumbs/Breadcrumbs.tsx index 2aa6f8b15..d880fde73 100644 --- a/web/core/Breadcrumbs/Breadcrumbs.tsx +++ b/web/core/Breadcrumbs/Breadcrumbs.tsx @@ -24,13 +24,17 @@ const buildJsonLdElements = (crumbs: Breadcrumb[], router: ReturnType text[0].toUpperCase() + text.slice(1) +const capitalize = (text: string): string => text?.[0].toUpperCase() + text?.slice(1) const parseBreadcrumbs = (crumbs: Breadcrumb[]) => { - return crumbs.map((item) => ({ - ...item, - label: capitalize(item.label), - })) + return crumbs + .filter((item) => item?.slug && item?.label) + .map((item) => { + return { + ...item, + label: capitalize(item.label), + } + }) } export const Breadcrumbs = ({ @@ -76,4 +80,4 @@ export const Breadcrumbs = ({ ) -} \ No newline at end of file +}