From 456cf011b36de91c9936994b1fa45703adcd309b Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Thu, 3 Jul 2025 10:56:21 +0300 Subject: Initial fork of chrismwilliams/astro-theme-cactus theme --- src/pages/rss.xml.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/pages/rss.xml.ts (limited to 'src/pages/rss.xml.ts') diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts new file mode 100644 index 0000000..1c305af --- /dev/null +++ b/src/pages/rss.xml.ts @@ -0,0 +1,19 @@ +import { getAllPosts } from "@/data/post"; +import { siteConfig } from "@/site.config"; +import rss from "@astrojs/rss"; + +export const GET = async () => { + const posts = await getAllPosts(); + + return rss({ + title: siteConfig.title, + description: siteConfig.description, + site: import.meta.env.SITE, + items: posts.map((post) => ({ + title: post.data.title, + description: post.data.description, + pubDate: post.data.publishDate, + link: `posts/${post.id}/`, + })), + }); +}; -- cgit v1.2.3