fix(BOOK-413): Respecting original_url inside RTE for entry links
Approved-by: Matilda Landström
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
@@ -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
|
|
||||||
# }
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user