From 70625ce62aba43e586901d340ae81c2830d9fbc6 Mon Sep 17 00:00:00 2001 From: LarsVomMars Date: Thu, 26 Dec 2024 23:41:15 +0100 Subject: init --- src/pages/rss.xml.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/pages/rss.xml.js (limited to 'src/pages/rss.xml.js') diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js new file mode 100644 index 0000000..ae5e4c4 --- /dev/null +++ b/src/pages/rss.xml.js @@ -0,0 +1,16 @@ +import rss from '@astrojs/rss'; +import { getCollection } from 'astro:content'; +import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; + +export async function GET(context) { + const posts = await getCollection('blog'); + return rss({ + title: SITE_TITLE, + description: SITE_DESCRIPTION, + site: context.site, + items: posts.map((post) => ({ + ...post.data, + link: `/blog/${post.id}/`, + })), + }); +} -- cgit v1.2.3