From fe416a017af462dd4e89bd842e4436f9fd3828f2 Mon Sep 17 00:00:00 2001 From: IChengHo <72492494+nasirHo@users.noreply.github.com> Date: Mon, 29 Sep 2025 23:36:10 -0400 Subject: [PATCH] fix(routes/udn/global): Correctly serialize multi-element article content (#20194) --- lib/routes/udn/global/index.ts | 6 +++++- lib/routes/udn/global/tag.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/routes/udn/global/index.ts b/lib/routes/udn/global/index.ts index bb3e50208..951a10d3b 100644 --- a/lib/routes/udn/global/index.ts +++ b/lib/routes/udn/global/index.ts @@ -81,7 +81,11 @@ async function handler(ctx) { item.pubDate = timezone(parseDate(content('meta[property="article:published_time"]').attr('content')), +8); const mainImage = content('.article-content__focus').html(); - const articleBodyHtml = content('.article-content__editor').find('p, figure, h2, .video-container').html(); + const articleBodyHtml = content('.article-content__editor') + .find('p, figure, h2, .video-container') + .toArray() + .map((e) => content.html(e)) + .join(''); item.description = mainImage + articleBodyHtml; item.category = content('meta[name="news_keywords"]').attr('content').split(','); diff --git a/lib/routes/udn/global/tag.ts b/lib/routes/udn/global/tag.ts index 7fa021437..7a3fc9b08 100644 --- a/lib/routes/udn/global/tag.ts +++ b/lib/routes/udn/global/tag.ts @@ -63,7 +63,11 @@ async function handler(ctx) { item.pubDate = timezone(parseDate(content('meta[property="article:published_time"]').attr('content')), +8); const mainImage = content('.article-content__focus').html(); - const articleBodyHtml = content('.article-content__editor').find('p, figure, h2, .video-container').html(); + const articleBodyHtml = content('.article-content__editor') + .find('p, figure, h2, .video-container') + .toArray() + .map((e) => content.html(e)) + .join(''); item.description = mainImage + articleBodyHtml; item.category = content('meta[name="news_keywords"]').attr('content').split(',');