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, + })) + });