diff --git a/components/Footer/Navigation/MainNav/index.tsx b/components/Footer/Navigation/MainNav/index.tsx index 91d674d60..e220af4a2 100644 --- a/components/Footer/Navigation/MainNav/index.tsx +++ b/components/Footer/Navigation/MainNav/index.tsx @@ -17,6 +17,7 @@ export default function FooterMainNav({ mainLinks }: FooterMainNavProps) { color="burgundy" href={link.url} className={styles.mainNavigationLink} + target={link.openInNewTab ? "_blank" : undefined} > {link.title} diff --git a/components/Footer/Navigation/SecondaryNav/index.tsx b/components/Footer/Navigation/SecondaryNav/index.tsx index 3f631f809..42266f915 100644 --- a/components/Footer/Navigation/SecondaryNav/index.tsx +++ b/components/Footer/Navigation/SecondaryNav/index.tsx @@ -56,26 +56,13 @@ export default function FooterSecondaryNav({ diff --git a/server/routers/contentstack/base/output.ts b/server/routers/contentstack/base/output.ts index 02651dfe2..50b739bdb 100644 --- a/server/routers/contentstack/base/output.ts +++ b/server/routers/contentstack/base/output.ts @@ -321,7 +321,7 @@ const validateInternalLink = z const lang = node.system.locale return { - url: originalUrl ?? removeMultipleSlashes(`/${lang}/${url}`), + url: originalUrl || removeMultipleSlashes(`/${lang}/${url}`), title: node.title, } }) @@ -339,14 +339,18 @@ export const validateLinkItem = z url: data.pageConnection?.url ?? data.link?.href ?? "", title: data?.title ?? data.link?.title, openInNewTab: data.open_in_new_tab, - isExternal: !!data.link?.href, + isExternal: !data.pageConnection?.url, } }) +const validateLinks = z + .array(validateLinkItem) + .transform((data) => data.filter((item) => item.url)) + export const validateSecondaryLinks = z.array( z.object({ title: z.string(), - links: z.array(validateLinkItem), + links: validateLinks, }) ) @@ -362,7 +366,7 @@ export const validateFooterConfigSchema = z all_footer: z.object({ items: z.array( z.object({ - main_links: z.array(validateLinkItem), + main_links: validateLinks, app_downloads: z.object({ title: z.string(), links: validateLinksWithType, @@ -371,7 +375,7 @@ export const validateFooterConfigSchema = z social_media: z.object({ links: validateLinksWithType, }), - tertiary_links: z.array(validateLinkItem), + tertiary_links: validateLinks, }) ), }),