RSS & Atom Feeds
Generate RSS and Atom feeds from your Boltdocs documentation with automatic i18n support.
The @bdocs/plugin-rss plugin automatically generates RSS 2.0 and Atom feeds from your documentation routes. It supports i18n, collection filtering, and requires zero configuration — just install and your site has a feed.
Concepts & Architecture
How It Works
-
Route Collection: After the SSG build completes, the plugin reads all generated routes from the
PluginContext. These are the same routes used to generate your site's pages. -
Metadata Extraction: For each route, the plugin extracts
title,description,excerpt,date,lastUpdated, andauthorfrom the route's frontmatter. -
Feed Generation: The plugin generates valid XML feeds (RSS 2.0 and/or Atom) with proper entity escaping and RFC 2822 / ISO 8601 date formatting.
-
i18n Support: If your config has
i18nenabled, the plugin automatically generates a separate feed for each locale. Routes are filtered by their locale prefix (e.g.,/es/docs/...goes to the Spanish feed). -
Output: Feed files are written to the build output directory alongside your static site files.
When Does It Run?
The plugin generates feeds through the build:generate lifecycle hook, which the build pipeline runs after the SSG output has been written to disk (with afterBuild kept as a compatibility fallback):
| Environment | Behavior |
|---|---|
Production build (boltdocs build) | Feeds are always generated |
Development (boltdocs dev) | Feeds are NOT generated by default |
To generate feeds during development, set devMode: true in the plugin options.
Configuration
Minimal Setup
The plugin works with zero configuration. It automatically reads from your existing boltdocs.config.ts:
| Source | Used For |
|---|---|
siteUrl | Feed URL base (required — plugin warns if missing) |
theme.title | Feed title (supports i18n Record<string, string>) |
theme.description | Feed description |
i18n.locales | Determines how many feeds to generate |
i18n.defaultLocale | Determines the default feed path (/feed.xml) |
Plugin Options
All options are optional. Pass them to the plugin factory function:
rssPlugin({
limit: 50,
format: 'both',
paths: ['/blog', '/docs'],
})
API Reference
Plugin Options Reference
| Property | Type | Default | Description |
|---|---|---|---|
limit | number | unlimited | Maximum number of items per feed. If not set, all routes are included. Range: 1–500. |
paths | string[] | undefined | Filter routes by path prefix. Only routes starting with these paths are included. |
collections | string[] | undefined | Filter routes by collection name (e.g., ['blog']). |
format | 'rss' | 'atom' | 'both' | 'rss' | Which feed format(s) to generate. |
devMode | boolean | false | If true, generates feeds during boltdocs dev. Disabled by default since feeds are only useful in production. |
Generated Files
The plugin writes feed files to the rss/ directory inside the build output:
| Format | Default Locale | Other Locales |
|---|---|---|
| RSS | /rss/rss-{locale}.xml | /rss/rss-{locale}.xml |
| Atom | /rss/atom-{locale}.xml | /rss/atom-{locale}.xml |
Feed Item Fields
Each item in the feed corresponds to a documentation route:
| RSS Field | Atom Field | Source |
|---|---|---|
<title> | <title> | route.title |
<link> | <link href> | siteUrl + route.path |
<description> | <summary> | route.excerpt or route.description |
<pubDate> | <updated> | route.date or route.lastUpdated |
<guid> | <id> | siteUrl + route.path |
Usage Examples
Basic Setup
import { defineConfig } from 'boltdocs'
import rssPlugin from '@bdocs/plugin-rss'
export default defineConfig({
siteUrl: 'https://docs.example.com',
plugins: [rssPlugin()],
})
Blog-Only Feed
If you have a blog collection and only want blog posts in your feed:
rssPlugin({
collections: ['blog'],
limit: 30,
format: 'both',
})
Custom Path Filter
Only include routes under /docs/guides:
rssPlugin({
paths: ['/docs/guides'],
limit: 10,
})
RSS and Atom Together
Generate both formats simultaneously:
rssPlugin({
format: 'both',
limit: 50,
})
Troubleshooting
Feed not generated
- Check
siteUrl: The plugin requiressiteUrlto be set in your config. Without it, the plugin logs a warning and skips generation. - Verify build output: Ensure the build completed successfully. The
afterBuildhook only runs on successful builds. - Check routes: The plugin generates feeds from all documentation routes. If no routes exist, the feed will be empty.
Feed has no items
- Check route filters: If you're using
pathsorcollections, ensure your routes match the filter criteria. - Check
draftflag: Routes withdraft: truein frontmatter are excluded from the feed. - Verify frontmatter: Routes need at least a
titleto appear in the feed. Items withoutdateorlastUpdateduse the current timestamp.
i18n feeds missing
- Verify
i18nconfig: Ensurei18n.defaultLocaleandi18n.localesare properly configured. - Check route locale prefixes: Routes must have locale prefixes (e.g.,
/es/docs/...) to be included in locale-specific feeds.
Wrong feed title
The feed title is derived from theme.title. If your title is an i18n object ({ en: 'Docs', es: 'Documentación' }), the plugin uses the matching locale key. If no match is found, it falls back to the first value.