export declare const rssLibTemplate = "import { config } from \"@/utils/config\";\n\nexport interface RssItem {\n title: string;\n anchor: string;\n description: string;\n}\n\nexport interface RssFeedData {\n // Page path relative to the site root, e.g. \"update\" or \"guides/setup\".\n // Empty string means the homepage feed (served from /rss.xml).\n pagePath: string;\n // Channel title; null falls back to the site name from config.json.\n title: string | null;\n // Channel description; null falls back to the config.json description.\n description: string | null;\n items: RssItem[];\n}\n\n// Same base-URL resolution as sitemap.ts/robots.ts: env override first, then\n// config.json. Without either, feed links degrade to root-relative paths.\nfunction resolveBaseUrl(): string | null {\n const raw = process.env.NEXT_PUBLIC_SITE_URL ?? config.url;\n if (!raw) return null;\n return raw.replace(/\\/$/, \"\");\n}\n\n// Ampersand first, or it would re-escape the other entities.\nfunction escapeXml(text: string): string {\n return text\n .replace(/&/g, \"&\")\n .replace(//g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n}\n\n// Builds the RSS 2.0 document for a page's subscribable changelog. Entry\n// descriptions arrive as pure Markdown (components, code, and HTML were\n// removed at generation time) and are entity-escaped here, so no CDATA\n// sections are needed. Entries carry no pubDate: the guid is the entry's\n// permalink, so feed readers surface new entries when new guids appear.\nexport function buildRssFeed(feed: RssFeedData): string {\n const base = resolveBaseUrl() ?? \"\";\n // The homepage feed has an empty pagePath; joining through this prefix\n // keeps its URLs free of double slashes (\"//rss.xml\" would be read as a\n // protocol-relative URL).\n const pagePrefix = feed.pagePath ? `/${feed.pagePath}` : \"\";\n const pageUrl = `${base}${pagePrefix}` || \"/\";\n const feedUrl = `${base}${pagePrefix}/rss.xml`;\n const siteName = config.name || \"Documentation\";\n const title = feed.title ?? siteName;\n const description = feed.description ?? config.description ?? title;\n\n const items = feed.items.map((item) => {\n const link = `${pageUrl}#${item.anchor}`;\n return [\n \" - \",\n ` ${escapeXml(item.title)}`,\n ` ${escapeXml(link)}`,\n ` ${escapeXml(link)}`,\n ` ${escapeXml(item.description)}`,\n \"
\",\n ].join(\"\\n\");\n });\n\n return [\n ``,\n ``,\n \" \",\n ` ${escapeXml(title)}`,\n ` ${escapeXml(pageUrl)}`,\n ` ${escapeXml(description)}`,\n ` `,\n ` ${new Date().toUTCString()}`,\n ` ${escapeXml(siteName)}`,\n ...items,\n \" \",\n \"\",\n \"\",\n ].join(\"\\n\");\n}\n";