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) {
|
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>`,
|
2024-09-11 22:03:55 +00:00
|
|
|
description: import.meta.env.DEFAULT_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,
|
2024-09-11 22:03:55 +00:00
|
|
|
title: import.meta.env.DEFAULT_TITLE,
|
2024-09-04 21:45:53 +00:00
|
|
|
});
|
|
|
|
|
}
|