jevstrudel.git / website / src / pages / rss.xml.js
1import rss from '@astrojs/rss';
2import { getCollection } from 'astro:content';
3
4export async function GET(context) {
5  const posts = (await getCollection('blog')).filter((p) => !p.data.draft);
6  const options = {
7    title: 'Strudel Blog',
8    description:
9      'The Strudel Blog will keep you updated with the latest changes and things happening in the strudelsphere.',
10    site: context.site,
11    items: posts.map((post) => ({
12      link: `/blog/#${post.slug}`,
13      title: post.data.title,
14      pubDate: post.data.date,
15      description: post.data.description,
16    })),
17  };
18  return rss(options);
19}