File tree Expand file tree Collapse file tree
web/sections/searchBlocks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { defaultLanguage } from '@/languageConfig'
77import { host } from '@/lib/config'
88import { Highlight } from './Highlight'
99import DisplayLink from './hit/DisplayLink'
10+ import { getLocaleFromIso , getNameFromLocale } from '@/sanity/helpers/localization'
1011
1112export type HitData = {
1213 slug ?: string
@@ -26,9 +27,8 @@ export type HitProps = { hit: UniversalHitType }
2627const buildDisplayURL = ( slug : string , locale : string | undefined ) : string => {
2728 const startsWithLocale =
2829 slug . startsWith ( `${ locale } /` ) || slug . startsWith ( `/${ locale } /` )
29-
30- return locale && locale !== defaultLanguage ?. locale && ! startsWithLocale
31- ? `${ host . url } /${ locale } /${ slug . replace ( / ^ \/ / , '' ) } `
30+ return locale && locale !== defaultLanguage ?. iso && ! startsWithLocale
31+ ? `${ host . url } /${ getLocaleFromIso ( locale ) } /${ slug . replace ( / ^ \/ / , '' ) } `
3232 : `${ host . url } ${ slug } `
3333}
3434
You can’t perform that action at this time.
0 commit comments