From 69112f3976a9d8a08c86ef2cf03ef0ddf8d8a195 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 13 Oct 2022 00:15:24 +0100 Subject: [PATCH] fix: add article content to description --- website/src/pages/archive.xml.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/website/src/pages/archive.xml.js b/website/src/pages/archive.xml.js index 00bf66cd..1a7a655d 100644 --- a/website/src/pages/archive.xml.js +++ b/website/src/pages/archive.xml.js @@ -1,8 +1,20 @@ import rss from '@astrojs/rss'; +const emailImportResult = import.meta.glob('./daily-emails/**/*.md', { eager: true }); +const emails = Object.values(emailImportResult) + .sort((a, b) => + new Date(b.frontmatter.pubDate).valueOf() - + new Date(a.frontmatter.pubDate).valueOf() + ) + export const get = () => rss({ - title: 'Daily list', - description: '', - site: 'https://www.oliverdavies.uk', - items: import.meta.glob('./daily-emails/**/*.{md,mdx}'), -}) + title: 'Daily list', + description: 'A daily newsletter on software development, DevOps, community, and open-source.', + site: import.meta.env.SITE, + items: emails.map((email) => ({ + description: email.compiledContent(), + link: email.url, + pubDate: email.frontmatter.pubDate, + title: email.frontmatter.title, + })) + });