add RSS feed
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import rss from '@astrojs/rss';
|
||||
|
||||
import { render } from 'astro:content';
|
||||
import { listPosts } from '@lib/content.ts';
|
||||
|
||||
|
||||
export async function GET(context) {
|
||||
const entries = await listPosts();
|
||||
const items = await Promise.all(entries.map(async entry => {
|
||||
const { remarkPluginFrontmatter } = await render(entry);
|
||||
return {
|
||||
title: entry.data.title,
|
||||
description: remarkPluginFrontmatter.description,
|
||||
link: `https://blog.jfmonty2.com/${entry.id}`,
|
||||
pubDate: entry.data.date,
|
||||
};
|
||||
}));
|
||||
|
||||
return rss({
|
||||
title: "Joe's Blog",
|
||||
description: 'I write about stuff.',
|
||||
site: 'https://blog.jfmonty2.com',
|
||||
items,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user