mirror of
https://github.com/10h30/blog-balodeplao.git
synced 2026-05-12 15:21:15 +09:00
Initial commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import rss from "@astrojs/rss";
|
||||
import { getCollection } from "astro:content";
|
||||
import { siteConfig } from "@/config/site";
|
||||
|
||||
export async function GET(context) {
|
||||
const blog = await getCollection("blog");
|
||||
|
||||
return rss({
|
||||
title: siteConfig.name,
|
||||
description: siteConfig.description,
|
||||
site: context.site,
|
||||
items: blog
|
||||
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf())
|
||||
.map((post) => ({
|
||||
title: post.data.title,
|
||||
pubDate: post.data.pubDate,
|
||||
description: post.data.description,
|
||||
link: `/blog/${post.id}/`,
|
||||
content: post.body, // Optional: include full content
|
||||
customData: post.data.author
|
||||
? `<author>${post.data.author}</author>`
|
||||
: undefined,
|
||||
})),
|
||||
customData: `<language>${siteConfig.locale}</language>`,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user