Add RSS feed functionality and update footer with RSS link
This commit is contained in:
parent
03a62f59c1
commit
655d43265f
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
import Social from "@components/common/Social.astro";
|
||||
import { FiRss } from 'react-icons/fi';
|
||||
---
|
||||
|
||||
<footer class="glass container lg:my-4 lg:rounded-lg intersect:animate-fadeUp opacity-0">
|
||||
|
|
@ -22,6 +23,10 @@ import Social from "@components/common/Social.astro";
|
|||
linkedIn: "https://www.linkedin.com/in/kristian-emil-takvam-70a475215/",
|
||||
}}
|
||||
/>
|
||||
<a href="/rss.xml" target="_blank" rel="noopener" class="text-orange-500 hover:text-orange-400">
|
||||
<FiRss size={24} />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
|||
|
|
@ -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: `<language>en-us</language>`,
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue