2026-03-24 18:09:42 +00:00
|
|
|
import rss from '@astrojs/rss';
|
|
|
|
|
import { pagesGlobToRssItems } from '@astrojs/rss';
|
|
|
|
|
import { getCollection } from 'astro:content';
|
2026-03-24 18:01:45 +00:00
|
|
|
|
|
|
|
|
export async function GET(context) {
|
2026-03-24 18:09:42 +00:00
|
|
|
const posts = await getCollection("blog");
|
2026-03-30 15:01:38 +00:00
|
|
|
|
2026-03-24 18:01:45 +00:00
|
|
|
return rss({
|
2026-03-26 16:55:50 +00:00
|
|
|
title: 'Cloverta的博客',
|
|
|
|
|
description: '在这里,发现更多(雾)欢迎来到三叶的博客🥳',
|
2026-03-24 18:01:45 +00:00
|
|
|
site: context.site,
|
|
|
|
|
items: await pagesGlobToRssItems(import.meta.glob('./**/*.md')),
|
2026-03-30 15:04:35 +00:00
|
|
|
items: posts.map((post) => {
|
|
|
|
|
const [postLang, ...slugParts] = post.id.split("/");
|
|
|
|
|
const slug = slugParts.join("/");
|
|
|
|
|
|
|
|
|
|
return ({
|
|
|
|
|
title: post.data.title,
|
|
|
|
|
pubDate: post.data.pubDate,
|
|
|
|
|
description: post.data.description,
|
|
|
|
|
link: `/zh/posts/${slug}/`,
|
|
|
|
|
})
|
|
|
|
|
}),
|
2026-03-24 18:01:45 +00:00
|
|
|
customData: `<language>en-us</language>`,
|
2026-03-24 18:09:42 +00:00
|
|
|
})
|
2026-03-24 18:01:45 +00:00
|
|
|
}
|