fix(BOOK-413): Respecting original_url inside RTE for entry links

Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-10-08 07:25:32 +00:00
parent 2176a7dd6f
commit b685c928e4
2 changed files with 7 additions and 6 deletions

View File

@@ -451,17 +451,22 @@ export const renderOptions: RenderOptions = {
) { ) {
// If entry is not an ImageContainer, it is a page and we return it as a link // If entry is not an ImageContainer, it is a page and we return it as a link
const { className, ...props } = extractPossibleAttributes(node.attrs) const { className, ...props } = extractPossibleAttributes(node.attrs)
const entryHref = entry.node.url
const href = node.attrs?.locale const nodeHref = node.attrs?.locale
? `/${node.attrs.locale}${node.attrs.href ?? node.attrs.url}` ? `/${node.attrs.locale}${node.attrs.href ?? node.attrs.url}`
: ((node.attrs.href ?? node.attrs.url) as string) : ((node.attrs.href ?? node.attrs.url) as string)
if (!entryHref && !nodeHref) {
return null
}
return ( return (
<Link <Link
key={node.uid} key={node.uid}
className={className} className={className}
{...props} {...props}
href={href} href={entryHref ?? nodeHref}
textDecoration="underline" textDecoration="underline"
> >
{next( {next(

View File

@@ -6,8 +6,4 @@ fragment HotelPageLink on HotelPage {
} }
title title
url url
# TODO: Might need to add this if this is needed for hotel pages.
# web {
# original_url
# }
} }