✨ added RSS to site
This commit is contained in:
parent
35e2312e06
commit
8a32c3bf0c
1 changed files with 18 additions and 0 deletions
18
src/pages/rss.xml.js
Normal file
18
src/pages/rss.xml.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import rss from '@astrojs/rss';
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
export async function GET(context) {
|
||||
const blog = await getCollection('blog');
|
||||
return rss({
|
||||
title: 'Sindre Kjelsrud',
|
||||
description: 'Recent content on Sindre Kjelsrud`s blog',
|
||||
site: context.site,
|
||||
items: blog.map((post) => ({
|
||||
title: post.data.title,
|
||||
pubDate: post.data.pubDate,
|
||||
description: post.data.description,
|
||||
customData: post.data.customData,
|
||||
link: `/blog/${post.slug}/`,
|
||||
})),
|
||||
});
|
||||
}
|
Loading…
Add table
Reference in a new issue