Add RSS support
This commit is contained in:
@ -12,11 +12,14 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/image": "^0.3.3",
|
||||
"@astrojs/rss": "^1.0.0",
|
||||
"@astrojs/sitemap": "^1.0.0",
|
||||
"@astrojs/tailwind": "^1.0.0",
|
||||
"@tailwindcss/typography": "^0.5.4",
|
||||
"astro": "^1.0.0",
|
||||
"prettier": "^2.7.1",
|
||||
"prettier-plugin-astro": "^0.5.0",
|
||||
"reading-time": "^1.5.0",
|
||||
"subfont": "^6.9.0"
|
||||
}
|
||||
}
|
||||
|
20
src/pages/rss.xml.js
Normal file
20
src/pages/rss.xml.js
Normal 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,
|
||||
})),
|
||||
});
|
Reference in New Issue
Block a user