From 0189a95ae73bda7ebd1a5106e9e3de6e631ca946 Mon Sep 17 00:00:00 2001 From: Thibault <54189871+Asaren1070@users.noreply.github.com> Date: Mon, 16 Jun 2025 13:58:40 +0100 Subject: [PATCH] fix: fix display of YouTube videos in blog posts (#448) --- .../components/shared/BlockRendererClient.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/shared/BlockRendererClient.tsx b/frontend/src/components/shared/BlockRendererClient.tsx index fd49c8c..9cd236f 100644 --- a/frontend/src/components/shared/BlockRendererClient.tsx +++ b/frontend/src/components/shared/BlockRendererClient.tsx @@ -19,7 +19,7 @@ export default function BlockRendererClient({ }) { if (!content) return null; return ( -
+
{children}

; + return
{children}
; } - return

{children}

; + return ( +
{children}
+ ); }, link: ({ url, children }) => { @@ -72,13 +74,16 @@ export default function BlockRendererClient({ const isYouTubeVideo = url.includes("youtube.com"); // Render the iframe only if it's a YouTube video link if (isYouTubeVideo) { + const videoId = url.split("v=")[1]?.split("&")[0]; + const embedUrl = `https://www.youtube.com/embed/${videoId}`; return ( -
+
);