generateRegistryRssFeed
Generate an RSS feed from your registry.
Generate an RSS 2.0 compliant feed from your registry.
Signature
function generateRegistryRssFeed(
options: GenerateRssOptions
): Promise<string | null>;Parameters
| Option | Type | Description |
|---|---|---|
baseUrl | string | Your registry base URL |
rss.title | string | Feed title |
rss.description | string | Feed description |
rss.endpoint | string | RSS endpoint path (default: /rss) |
rss.limit | number | Maximum number of items in feed |
github.owner | string | GitHub repository owner |
github.repo | string | GitHub repository name |
github.token | string | GitHub API token for commit dates |
Returns
Promise<string | null> — The RSS feed XML string, or null if no items found.
Example
import { generateRegistryRssFeed } from "@insightcn/sdk";
const rss = await generateRegistryRssFeed({
baseUrl: "https://your-registry.com",
rss: {
title: "My Shadcn Registry",
description: "Custom components for shadcn/ui",
},
});
console.log(rss);With GitHub Integration
const rss = await generateRegistryRssFeed({
baseUrl: "https://your-registry.com",
rss: {
title: "My Shadcn Registry",
description: "Custom components for shadcn/ui",
endpoint: "/api/rss",
},
github: {
owner: "your-org",
repo: "your-registry",
token: process.env.GITHUB_TOKEN,
},
});Feed Structure
The generated feed includes:
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>My Shadcn Registry</title>
<link>https://your-registry.com</link>
<description>Custom components for shadcn/ui</description>
<atom:link href="https://your-registry.com/rss" rel="self" type="application/rss+xml" />
<item>
<title>Button</title>
<link>https://your-registry.com/r/ui/button.json</link>
<guid>https://your-registry.com/r/ui/button.json</guid>
<description>A clickable button</description>
<pubDate>Mon, 01 Jan 2024 00:00:00 GMT</pubDate>
</item>
</channel>
</rss>