fix(route/scmp): Adapt to new section format (#22085)

* fix(route/scmp): Adapt to new section format

* Update utils.ts
This commit is contained in:
Andvari 2026-05-23 21:38:33 +08:00 committed by GitHub
parent b5bcb8a567
commit 6f9b7c99f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ export const parseItem = async (item) => {
item.summary = renderHTML(article.summary.json);
item.description = renderHTML(article.subHeadline.json) + renderHTML(article.images.find((i) => i.type === 'leading')) + renderHTML(article.body.json);
item.updated = parseDate(article.updatedDate, 'x');
item.category = [...new Set([...article.topics.map((t) => t.name), ...article.sections.flatMap((t) => t.value.map((v) => v.name)), ...article.keywords.map((k) => k?.split(', '))])];
item.category = [...new Set([...article.topics.map((t) => t.name), ...((article.sectionsV2?.flatMap((t) => t.value.map((v) => v.name))) ?? []), ...article.keywords.map((k) => k?.split(', '))])];
// N.B. gallery in article is not rendered
// e.g., { type: 'div', attribs: { class: 'scmp-photo-gallery', 'data-gallery-nid': '3239409' }}