Skip to content

Add built-in RSS feed support#29

Merged
jolestar merged 2 commits into
mainfrom
fix/issue-28-rss-feed
Mar 31, 2026
Merged

Add built-in RSS feed support#29
jolestar merged 2 commits into
mainfrom
fix/issue-28-rss-feed

Conversation

@jolestar
Copy link
Copy Markdown
Owner

Summary

  • add built-in /feed.xml support when siteUrl is configured
  • auto-enable RSS by default, with rss: false to disable it
  • emit RSS autodiscovery links in rendered HTML pages

Details

  • only include dated posts in the feed
  • exclude drafts and pages
  • support optional rss.title, rss.description, rss.author, and rss.maxItems
  • document the new route and configuration behavior

Verification

  • npm run check
  • npm test

Closes #28

Copilot AI review requested due to automatic review settings March 31, 2026 15:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class RSS support to mdorigin by introducing a built-in /feed.xml route (gated by siteUrl + RSS enablement), exposing RSS configuration in site config, and emitting RSS autodiscovery link tags in rendered HTML.

Changes:

  • Add /feed.xml route that generates an RSS 2.0 feed from dated post content (excluding pages and drafts when draftMode: 'exclude').
  • Add rss configuration (rss: false to disable; overrides for title/description/author/maxItems) and corresponding normalization + tests.
  • Emit RSS autodiscovery <link rel="alternate" type="application/rss+xml" ...> in HTML and document the new behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/html/template.ts Adds optional RSS autodiscovery <link> emission via rssFeedUrl.
src/core/site-config.ts Introduces RSS config types and normalization into resolved site config.
src/core/site-config.test.ts Adds coverage for RSS config normalization + disabling.
src/core/request-handler.ts Adds /feed.xml route, feed item collection, and wiring RSS URL into HTML rendering.
src/core/request-handler.test.ts Verifies feed output filtering and HTML autodiscovery link presence.
skills/mdorigin/SKILL.md Updates skill description to mention /feed.xml support.
docs/site/reference/configuration.md Documents RSS defaults, disable switch, and overrides.
docs/site/guides/getting-started.md Adds getting-started guidance for /feed.xml and RSS config.
docs/site/concepts/routing.md Documents routing for /feed.xml and autodiscovery behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +680 to +687
const entries = await store.listDirectory(directoryPath);
if (entries === null) {
return [];
}

const feedItems: FeedItem[] = [];
const directoryShape = await inspectDirectoryShape(store, directoryPath);

Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collectRssFeedItems() calls store.listDirectory(directoryPath) and then immediately calls inspectDirectoryShape(store, directoryPath), which performs a second listDirectory() of the same directory. For large trees or remote-backed stores this doubles I/O per directory during feed generation. Consider deriving the DirectoryShape from the already-fetched entries (or adding an inspectDirectoryShapeFromEntries helper) so each directory is listed only once per traversal.

Copilot uses AI. Check for mistakes.
Comment thread src/core/request-handler.ts Outdated
Comment on lines +1023 to +1030
function trimLeadingSlash(value: string): string {
return value.startsWith('/') ? value.slice(1) : value;
}

function ensureTrailingSlash(value: string): string {
return value.endsWith('/') ? value : `${value}/`;
}

Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trimLeadingSlash() and ensureTrailingSlash() are duplicated here but identical helpers already exist in src/search.ts. Duplicating URL-manipulation utilities increases the chance of subtle drift (e.g., around trailing slashes or edge cases) between search canonical URLs and feed URLs. Consider extracting these helpers into a shared utility module and importing them from both places.

Suggested change
function trimLeadingSlash(value: string): string {
return value.startsWith('/') ? value.slice(1) : value;
}
function ensureTrailingSlash(value: string): string {
return value.endsWith('/') ? value : `${value}/`;
}

Copilot uses AI. Check for mistakes.
@jolestar jolestar merged commit 808fcc9 into main Mar 31, 2026
1 check passed
@jolestar jolestar deleted the fix/issue-28-rss-feed branch March 31, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add first-class RSS/feed support for content sites

2 participants