From a8c0b54ae7c5dad39f59e89a9f3c055e232b6a57 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 19 Oct 2023 20:04:09 +0200 Subject: [PATCH] feat: use "drupal" or "drupal-planet" tags Return emails that are tagged with either "drupal" or "drupal-planet". --- src/pages/rss/drupal-planet.xml.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/pages/rss/drupal-planet.xml.js b/src/pages/rss/drupal-planet.xml.js index 7bc3b18c..dab5e1e1 100644 --- a/src/pages/rss/drupal-planet.xml.js +++ b/src/pages/rss/drupal-planet.xml.js @@ -4,12 +4,21 @@ import rss from '@astrojs/rss'; import sanitizeHtml from 'sanitize-html'; import { getCollection } from 'astro:content'; +/** + * Determines if a post should be shown based on its tags. + */ +const isDrupalPost = (email) => { + if (email.data.tags?.includes('drupal-planet')) { + return true; + } + + return email.data.tags?.includes('drupal'); +}; + export async function get() { const emails = await getCollection('daily-email'); - const filteredEmails = Object.values(emails).filter(e => { - return e.data.tags?.includes('drupal'); - }); + const filteredEmails = Object.values(emails).filter(e => isDrupalPost(e)); const sortedEmails = filteredEmails .sort((a, b) =>