Skip to content

Commit 203b711

Browse files
committed
More #3484
1 parent a894358 commit 203b711

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

web/core/Link/ResourceLink.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export const ResourceLink = forwardRef<HTMLAnchorElement, ResourceLinkProps>(
105105
showExtensionIcon = false,
106106
ariaHideText = false,
107107
href = '',
108+
hrefLang,
108109
file,
109110
},
110111
ref,
@@ -183,7 +184,7 @@ export const ResourceLink = forwardRef<HTMLAnchorElement, ResourceLinkProps>(
183184
}
184185

185186
return href ? (
186-
<BaseLink className={classNames} type={type} ref={ref} href={href}>
187+
<BaseLink className={classNames} type={type} ref={ref} href={href} hrefLang={hrefLang}>
187188
<div
188189
className={twMerge(
189190
`flex h-full w-inherit items-center justify-start gap-x-2 ${contentVariantClassName[variant]}`,

web/lib/helpers/getUrlFromAction.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ export const getUrlFromAction = ({
1212
if (!type && !href) return undefined
1313

1414
const anchor = anchorReference ? `#${anchorReference}` : ''
15-
const locale = link?.lang !== defaultLanguage.name? getLocaleFromName(link?.lang) :""
16-
15+
const locale = link?.lang !== defaultLanguage.name? `/${getLocaleFromName(link?.lang)}` :""
1716

1817
if (type === 'internalUrl') {
1918
if (!link?.slug) {
2019
console.warn('Missing slug in action:', fileName)
2120
}
22-
return ("/"+locale+ link?.slug + anchor) || ''
21+
return (locale+ link?.slug + anchor) || ''
2322
}
2423

2524
if (!href && type !== 'downloadableFile') {

web/sections/CallToActions/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const CallToActions = ({
3838
...file,
3939
label,
4040
}}
41+
{...(link?.lang && { hrefLang: getLocaleFromName(link?.lang) })}
4142
href={url}
4243
type={type}
4344
variant='fit'
@@ -69,6 +70,7 @@ const CallToActions = ({
6970
...file,
7071
label,
7172
}}
73+
{...(link?.lang && { hrefLang: getLocaleFromName(link?.lang) })}
7274
href={url}
7375
type={type}
7476
variant={linkVariant ? linkVariant : 'default'}

web/sections/RelatedContent/RelatedContent.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const RelatedContent = ({ data, className = '' }: RelatedContentProps) => {
2222
return (
2323
<li key={item.id}>
2424
<ResourceLink
25-
{...item}
2625
href={url as string}
2726
{...(item.link?.lang && {
2827
hrefLang: getLocaleFromName(item.link?.lang),

0 commit comments

Comments
 (0)