From 2344d078072bf78cd0170ed038d4b1974bb5ede4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar=20Vestmann?= Date: Thu, 30 Jan 2025 12:40:46 +0000 Subject: [PATCH] fix(web): /rss.xml link should be an anchor tag (#17693) * Make sure that rss.xml is an anchor tag * Remove unneeded ? --- .../Organization/Wrapper/OrganizationWrapper.tsx | 9 +++++---- libs/shared/utils/src/lib/shouldLinkBeAnAnchorTag.ts | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx b/apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx index a49acfd4ec95..f055c44002da 100644 --- a/apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx +++ b/apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx @@ -31,6 +31,7 @@ import { Text, } from '@island.is/island-ui/core' import { theme } from '@island.is/island-ui/theme' +import { shouldLinkBeAnAnchorTag } from '@island.is/shared/utils' import { BoostChatPanel, boostChatPanelEndpoints, @@ -1079,12 +1080,12 @@ export const OrganizationWrapper: React.FC< title={navigationData.title} activeItemTitle={activeNavigationItemTitle} renderLink={(link, item) => { - return item?.href ? ( - + return !item?.href || shouldLinkBeAnAnchorTag(item.href) ? ( + link + ) : ( + {link} - ) : ( - link ) }} /> diff --git a/libs/shared/utils/src/lib/shouldLinkBeAnAnchorTag.ts b/libs/shared/utils/src/lib/shouldLinkBeAnAnchorTag.ts index be735c1feb4f..b02da5b404f1 100644 --- a/libs/shared/utils/src/lib/shouldLinkBeAnAnchorTag.ts +++ b/libs/shared/utils/src/lib/shouldLinkBeAnAnchorTag.ts @@ -4,4 +4,5 @@ import { ProjectBasePath } from '@island.is/shared/constants' * then the link should be an anchor tag instead of a nextlink for example * */ export const shouldLinkBeAnAnchorTag = (path: string) => - Object.values(ProjectBasePath).some((basePath) => path.includes(basePath)) + Object.values(ProjectBasePath).some((basePath) => path.includes(basePath)) || + path.startsWith('/rss.xml')