fix(routes/udn/global): Correctly serialize multi-element article content (#20194)

This commit is contained in:
IChengHo 2025-09-29 23:36:10 -04:00 committed by GitHub
parent 016ea35ac1
commit fe416a017a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -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(',');

View File

@ -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(',');