blogs/sites/poetry/src/pages/rss.xml.js
Neeldhara Misra 632543db4d
Some checks are pending
Build / build (push) Waiting to run
Fix local images and em dash rendering
2026-06-25 05:21:34 +05:30

23 lines
762 B
JavaScript

import rss from "@astrojs/rss";
import { getCollection } from "astro:content";
import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
import { ACTIVE_BLOG_SITE } from "../blog-sites.js";
import { typographicText } from "@/lib/typography";
export async function GET(context) {
const posts = (await getCollection(ACTIVE_BLOG_SITE.key)).sort(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
);
return rss({
title: SITE_TITLE,
description: typographicText(SITE_DESCRIPTION),
site: context.site,
items: posts.map((post) => ({
...post.data,
title: typographicText(post.data.title),
description: typographicText(post.data.description),
link: `/${post.id.replace(/\/index$/, "")}/`,
})),
});
}