Add RSS support

This commit is contained in:
prototypa
2022-08-17 22:37:38 -04:00
parent 5a10034787
commit 9e00b021f6
2 changed files with 23 additions and 0 deletions

20
src/pages/rss.xml.js Normal file
View File

@ -0,0 +1,20 @@
import rss from "@astrojs/rss";
import { SITE } from "~/config";
import { getAllPosts } from "~/utils/getAllPosts";
const posts = await getAllPosts();
export const get = () =>
rss({
title: `${SITE.name}s Blog`,
description:
"A ready to start template to make your website using Astro and Tailwind CSS.",
site: import.meta.env.SITE,
items: posts.map((post) => ({
link: `blog/${post.slug}`,
title: post.title,
description: post.description,
pubDate: post.pubDate,
})),
});