diff --git a/packages/ndla-ui/src/Embed/RelatedContentEmbed.tsx b/packages/ndla-ui/src/Embed/RelatedContentEmbed.tsx index 5baa38e151..70587a7bc3 100644 --- a/packages/ndla-ui/src/Embed/RelatedContentEmbed.tsx +++ b/packages/ndla-ui/src/Embed/RelatedContentEmbed.tsx @@ -29,16 +29,14 @@ const RelatedContentEmbed = ({ embed, isOembed, subject, ndlaFrontendDomain }: P if (embedData.articleId && data) { const typeId = data.resource?.resourceTypes.find((rt) => contentTypeMapping[rt.id])?.id; const type = typeId ? contentTypeMapping[typeId] : undefined; - const path = - data.resource?.paths.find((p) => p.split("/")[1] === subject?.replace("urn:", "")) ?? - data.resource?.path ?? - `/article/${embedData.articleId}`; + const context = data.resource?.contexts.find((c) => c.rootId === subject); + const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`; return ( );