diff --git a/src/pages/rss/drupal-planet.xml.js b/src/pages/rss/drupal-planet.xml.js new file mode 100644 index 00000000..7bc3b18c --- /dev/null +++ b/src/pages/rss/drupal-planet.xml.js @@ -0,0 +1,38 @@ +import MarkdownIt from 'markdown-it'; +import _ from 'lodash'; +import rss from '@astrojs/rss'; +import sanitizeHtml from 'sanitize-html'; +import { getCollection } from 'astro:content'; + +export async function get() { + const emails = await getCollection('daily-email'); + + const filteredEmails = Object.values(emails).filter(e => { + return e.data.tags?.includes('drupal'); + }); + + const sortedEmails = filteredEmails + .sort((a, b) => + new Date(b.data.pubDate).valueOf() - + new Date(a.data.pubDate).valueOf() + ); + + const parser = new MarkdownIt(); + + return rss({ + title: 'Daily email list', + description: 'A daily newsletter on software development, DevOps, community, and open-source.', + site: import.meta.env.SITE, + + items: sortedEmails.slice(0, 1).map((email) => ({ + description: ` +