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

View File

@ -12,11 +12,14 @@
}, },
"devDependencies": { "devDependencies": {
"@astrojs/image": "^0.3.3", "@astrojs/image": "^0.3.3",
"@astrojs/rss": "^1.0.0",
"@astrojs/sitemap": "^1.0.0", "@astrojs/sitemap": "^1.0.0",
"@astrojs/tailwind": "^1.0.0", "@astrojs/tailwind": "^1.0.0",
"@tailwindcss/typography": "^0.5.4",
"astro": "^1.0.0", "astro": "^1.0.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"prettier-plugin-astro": "^0.5.0", "prettier-plugin-astro": "^0.5.0",
"reading-time": "^1.5.0",
"subfont": "^6.9.0" "subfont": "^6.9.0"
} }
} }

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,
})),
});