0
mirror of https://github.com/valentineus/popov.link.git synced 2025-10-24 18:14:06 +03:00
Files
popov.link/src/pages/feed.xml.js

26 lines
674 B
JavaScript
Raw Normal View History

2024-09-04 21:45:53 +00:00
import { getCollection } from "astro:content";
2024-09-06 08:21:27 +00:00
import rss from "@astrojs/rss";
2024-09-04 21:45:53 +00:00
export async function GET(context) {
const title = "RSS Feed | Valentin Popov Blog";
const description = "Follow the latest posts from Valentin Popov via RSS.";
2024-10-02 23:04:27 +00:00
const posts = await getCollection("blog", ({ data }) => {
return data.draft !== true;
});
2024-09-04 21:45:53 +00:00
return rss({
customData: `<language>ru-ru</language>`,
description: description,
2024-09-04 21:45:53 +00:00
items: posts.map((post) => ({
customData: post.data.customData,
description: post.data.description,
link: `/blog/${post.slug}`,
pubDate: post.data.pubDate,
title: post.data.title,
})),
site: context.site,
title: title,
2024-09-04 21:45:53 +00:00
});
}