diff options
Diffstat (limited to 'src/pages/rss.xml.ts')
| -rw-r--r-- | src/pages/rss.xml.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index 8a6525d..39f3964 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -1,19 +1,21 @@ import rss from "@astrojs/rss"; +import type { APIContext } from "astro"; import { getAllPosts } from "@/data/post"; import { siteConfig } from "@/site.config"; -export const GET = async () => { +export const GET = async (context: APIContext) => { const posts = await getAllPosts(); return rss({ title: siteConfig.title, description: siteConfig.description, - site: import.meta.env.SITE, + site: context.site || import.meta.env.SITE, items: posts.map((post) => ({ title: post.data.title, description: post.data.description, pubDate: post.data.publishDate, link: `posts/${post.id}/`, })), + customData: `<atom:link href="${context.site}rss.xml" rel="self" type="application/rss+xml" xmlns:atom="http://www.w3.org/2005/Atom" />`, }); }; |
