diff --git a/src/app/(routes)/blog/[slug]/_components/article-content.tsx b/src/app/(routes)/blog/[slug]/_components/article-content.tsx index 8145227..cd2e746 100644 --- a/src/app/(routes)/blog/[slug]/_components/article-content.tsx +++ b/src/app/(routes)/blog/[slug]/_components/article-content.tsx @@ -25,7 +25,6 @@ const markRenderers: RenderMark = { function createMaybeYoutubeEmbedLink(url: URL) { if (!url.hostname.includes("youtube.com")) return; - if (url.pathname.includes("embed")) { // already an embed link return url.href; @@ -44,37 +43,38 @@ const nodeRenderers: RenderNode = { [INLINES.HYPERLINK]: (node, children) => { const url = new URL(node.data.uri as string); - const href = generateEmbedHref(url); - - if ( - url.hostname.includes("youtube.com") || - url.hostname.includes("player.vimeo.com") || - children?.toString().toLowerCase().includes("iframe") // to handle uncommon cases, creator can set the text to "iframe" - ) { - return ( - - - - ); + if (children?.toString().toLowerCase().includes("iframe")) { + if ( + url.hostname.includes("youtube.com") || + url.hostname.includes("player.vimeo.com") + ) { + const href = generateEmbedHref(url); + return ( + + + + ); + } } + return ( {children}