From 655d43265f90fd01d933b23ba74d14b4aaee504d Mon Sep 17 00:00:00 2001 From: Krem Date: Tue, 7 Oct 2025 18:40:37 +0200 Subject: [PATCH] Add RSS feed functionality and update footer with RSS link --- src/components/base/Footer.astro | 5 +++++ src/pages/rss.xml.js | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/pages/rss.xml.js diff --git a/src/components/base/Footer.astro b/src/components/base/Footer.astro index d28ea1f..52d6fb6 100644 --- a/src/components/base/Footer.astro +++ b/src/components/base/Footer.astro @@ -1,5 +1,6 @@ --- import Social from "@components/common/Social.astro"; +import { FiRss } from 'react-icons/fi'; --- diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js new file mode 100644 index 0000000..6e605cf --- /dev/null +++ b/src/pages/rss.xml.js @@ -0,0 +1,22 @@ +import rss from '@astrojs/rss'; +import { getCollection } from 'astro:content'; + +export async function GET(context) { + // Load all blog posts from your "blog" content collection + const posts = await getCollection('blog'); + + return rss({ + title: 'Kristian Takvam — Blog', + description: 'Updates, notes, and thoughts by Kristian Takvam.', + site: context.site, // automatically pulls your "site" from astro.config.mjs + + items: posts.map((post) => ({ + title: post.data.title, + pubDate: post.data.date, + description: post.data.description, + link: `/blog/${post.slug}/`, + })), + + customData: `en-us`, + }); +}