add rss.xml

This commit is contained in:
Felix Roos 2024-01-18 12:49:22 +01:00
parent 9ba7b9b4d4
commit ae5e6e3ab8
5 changed files with 48 additions and 15 deletions

View file

@ -0,0 +1,19 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
export async function GET(context) {
const posts = (await getCollection('blog')).filter((p) => !p.data.draft);
const options = {
title: 'Strudel Blog',
description:
'The Strudel Blog will keep you updated with the latest changes and things happening in the strudelsphere.',
site: context.site,
items: posts.map((post) => ({
link: `/${post.slug}/`,
title: post.data.title,
pubDate: post.data.date,
description: post.data.description,
})),
};
return rss(options);
}