From d3fda9d0fbea7840a0a93feeb3853a6173798f18 Mon Sep 17 00:00:00 2001 From: "Claude (MonolithCMS)" Date: Sat, 9 May 2026 13:46:13 +0000 Subject: [PATCH] fix(seo): unwrap posts.content JSON before scanning for video embeds --- src/crates/monolith-server/src/routes/pages.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/crates/monolith-server/src/routes/pages.rs b/src/crates/monolith-server/src/routes/pages.rs index 220bebc..df51bdb 100644 --- a/src/crates/monolith-server/src/routes/pages.rs +++ b/src/crates/monolith-server/src/routes/pages.rs @@ -3619,7 +3619,19 @@ pub async fn sitemap(State(state): State>, site: SiteCtx) -> impl .unwrap_or_default(); rows.into_iter() .filter_map(|(slug, title, content)| { - let embeds = find_youtube_embeds(&content); + // `posts.content` is stored as TipTap JSON, block JSON, or + // a JSON-string-quoted HTML literal. Apply the same fallback + // chain as the post handlers before scanning for iframes — + // raw `posts.content` has `\"` in place of `"`, so the iframe + // attribute parser would never match. + let html = if let Some(h) = monolith_core::blocks::try_render_tiptap(&content) { + h + } else if let Some(blocks) = monolith_core::blocks::parse_blocks(&content) { + monolith_core::blocks::render_blocks(&blocks) + } else { + monolith_core::blocks::unwrap_json_string(&content) + }; + let embeds = find_youtube_embeds(&html); if embeds.is_empty() { None } else {