Skip to content

Commit cecc4ce

Browse files
committed
Fix repeated locale in url
1 parent ddfd9de commit cecc4ce

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

web/sections/SiteMenu/FeaturedContent.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { getLocaleFromIso } from '@/sanity/helpers/localization'
88
import { EventCard } from '@/sections/cards/EventCard'
99
import type { FeaturedContentData } from '../../types/index'
1010
import type { EventCardData } from '../cards/EventCard/EventCard'
11+
import { de } from 'zod/v4/locales'
1112

1213
type Props = {
1314
featuredContent: FeaturedContentData
@@ -30,8 +31,8 @@ const FeaturedContent = ({
3031
data?.routeContentType === 'event'
3132
const { type, heroImage, title, ingress, slug } = featuredContent
3233

33-
const locale = iso !== defaultLanguage.name ? getLocaleFromIso(iso) : ''
34-
const href = '/' + locale + slug || ''
34+
const locale = iso !== defaultLanguage.iso ? `/${getLocaleFromIso(iso)}` : ''
35+
const href = locale + slug || ''
3536

3637
return (
3738
<div className=''>

web/sections/SiteMenu/MenuItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function getLink(menuLinkData: MenuLinkData, iso: string) {
2323
// the static pages are migrated
2424
if (!menuLinkData) return 'something-wrong'
2525
// manually setting lang here.. as menu links only allow same language links..
26-
const locale = iso !== defaultLanguage.name ? getLocaleFromIso(iso) : ''
27-
return '/' + locale + menuLinkData.link?.slug || ''
26+
const locale = iso !== defaultLanguage.iso ? `/${getLocaleFromIso(iso)}` : ''
27+
return locale + menuLinkData.link?.slug || ''
2828
}
2929

3030
type MenuGroupType = {

0 commit comments

Comments
 (0)