diff --git a/lib/routes/apnews/api.ts b/lib/routes/apnews/api.ts index fffed46252da09..28d7e0f4f01370 100644 --- a/lib/routes/apnews/api.ts +++ b/lib/routes/apnews/api.ts @@ -44,14 +44,19 @@ async function handler(ctx) { title: e.contents[0]?.headline, link: e.contents[0]?.localLinkUrl, pubDate: timezone(parseDate(e.publishedDate), 0), + category: e.tagObjs.map((tag) => tag.name), + updated: timezone(parseDate(e.contents[0]?.updated), 0), + description: e.contents[0]?.storyHTML, + author: e.contents[0]?.reporters.map((author) => ({ name: author.displayName })), })) .sort((a, b) => b.pubDate - a.pubDate) .slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 20); - const items = await Promise.all(list.map((item) => fetchArticle(item))); + const items = ctx.req.query('mode') === 'fulltext' ? await Promise.all(list.map((item) => fetchArticle(item))) : list; return { title: `${res.tagObjs[0].name} - AP News`, item: items, + link: 'https://apnews.com', }; } diff --git a/lib/routes/apnews/sitemap.ts b/lib/routes/apnews/sitemap.ts index 4102d5e1076bc7..07d89f9fda28bb 100644 --- a/lib/routes/apnews/sitemap.ts +++ b/lib/routes/apnews/sitemap.ts @@ -87,6 +87,7 @@ async function handler(ctx) { return { title: `AP News sitemap:${route}`, item: items, + link: 'https://apnews.com', }; } async function asyncPoolAll(poolLimit: number, array: readonly IN[], iteratorFn: (generator: IN) => Promise) {