forked from monero-project/monero-site
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeed.xml.js
More file actions
24 lines (22 loc) · 710 Bytes
/
Copy pathfeed.xml.js
File metadata and controls
24 lines (22 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import rss from "@astrojs/rss";
import { getDateStringFromId } from "@/utils/blog";
import { getCollection } from "astro:content";
import { createSafeMarkdown } from "@/utils/safeMarkdown";
const safeMarkdown = createSafeMarkdown();
export async function GET(context) {
const blog = (await getCollection("blog")).sort((a, b) =>
b.id.localeCompare(a.id),
);
return rss({
title: "Monero",
description: "Monero Blog RSS Feed",
site: context.site,
items: blog.map((post) => ({
title: post.data.title,
pubDate: getDateStringFromId(post.id),
description: post.data.summary,
link: `/blog/${post.id}/`,
content: safeMarkdown.parse(post.body),
})),
});
}