feat: use "drupal" or "drupal-planet" tags
Return emails that are tagged with either "drupal" or "drupal-planet".
This commit is contained in:
parent
c4c5843b23
commit
a8c0b54ae7
|
@ -4,12 +4,21 @@ import rss from '@astrojs/rss';
|
||||||
import sanitizeHtml from 'sanitize-html';
|
import sanitizeHtml from 'sanitize-html';
|
||||||
import { getCollection } from 'astro:content';
|
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() {
|
export async function get() {
|
||||||
const emails = await getCollection('daily-email');
|
const emails = await getCollection('daily-email');
|
||||||
|
|
||||||
const filteredEmails = Object.values(emails).filter(e => {
|
const filteredEmails = Object.values(emails).filter(e => isDrupalPost(e));
|
||||||
return e.data.tags?.includes('drupal');
|
|
||||||
});
|
|
||||||
|
|
||||||
const sortedEmails = filteredEmails
|
const sortedEmails = filteredEmails
|
||||||
.sort((a, b) =>
|
.sort((a, b) =>
|
||||||
|
|
Loading…
Reference in a new issue