diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2026-01-12 18:21:12 +0100 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2026-01-12 19:11:50 +0100 |
| commit | 51aa63873681216026d518cde4abeca307818a4b (patch) | |
| tree | d57b19a6ed8ce2b7303191a668de6ed7f878e7a8 /src/pages/rss.xml.ts | |
| parent | 4ed3a82a8b8f111bed88559bf8d601bb7d947df9 (diff) | |
Add infinite posts downloads
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" />`, }); }; |
