Saltar al contenido principal

Function: useAstroCreateRssEndpoint()

useAstroCreateRssEndpoint(config): (context) => Promise<Response>

Defined in: src/adapters/astro/rss.service.ts:191

Create an Astro-compatible GET endpoint handler for the RSS feed.

Parameters

config

Omit<RssConfig, "items"> & object

RSS config with items (static array or async factory)

Returns

Astro GET handler function

(context) => Promise<Response>

Example

// src/pages/rss.xml.ts
import { useAstroCreateRssEndpoint } from "katanakit-js/adapters/astro";
import { getCollection } from "astro:content";

export const GET = useAstroCreateRssEndpoint({
title: "My Blog",
description: "Posts about TypeScript",
site: "https://example.com",
items: async () => {
const posts = await getCollection("blog");
return posts.map(post => ({
title: post.data.title,
pubDate: post.data.date,
link: `/blog/${post.slug}/`,
}));
},
});