Initial commit
This commit is contained in:
commit
383f8bc667
91 changed files with 9972 additions and 0 deletions
20
src/pages/rss.xml.ts
Normal file
20
src/pages/rss.xml.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import rss from "@astrojs/rss";
|
||||
import { getCollection } from "astro:content";
|
||||
import getSortedPosts from "@utils/getSortedPosts";
|
||||
import { SITE } from "@config";
|
||||
|
||||
export async function GET() {
|
||||
const posts = await getCollection("blog");
|
||||
const sortedPosts = getSortedPosts(posts);
|
||||
return rss({
|
||||
title: SITE.title,
|
||||
description: SITE.desc,
|
||||
site: SITE.website,
|
||||
items: sortedPosts.map(({ data, slug }) => ({
|
||||
link: `posts/${slug}/`,
|
||||
title: data.title,
|
||||
description: data.description,
|
||||
pubDate: new Date(data.modDatetime ?? data.pubDatetime),
|
||||
})),
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue