From 7770a0852c0ba9cb0790d447cb3af0a5bf00e2ba Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 4 Sep 2024 21:45:53 +0000 Subject: Added RSS --- src/pages/feed.xml.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/pages/feed.xml.js (limited to 'src/pages') diff --git a/src/pages/feed.xml.js b/src/pages/feed.xml.js new file mode 100644 index 0000000..0fcc82f --- /dev/null +++ b/src/pages/feed.xml.js @@ -0,0 +1,20 @@ +import rss from "@astrojs/rss"; +import { getCollection } from "astro:content"; + +export async function GET(context) { + const posts = await getCollection("blog"); + + return rss({ + customData: `ru-ru`, + description: "Tech insights and coding best practices from an OpenSource enthusiast and ethical hacker.", + items: posts.map((post) => ({ + customData: post.data.customData, + description: post.data.description, + link: `/blog/${post.slug}`, + pubDate: post.data.pubDate, + title: post.data.title, + })), + site: context.site, + title: "Valentin Popov’s Technology Blog", + }); +} -- cgit v1.2.3