mdbook-rss-feed
An mdBook preprocessor that generates RSS, Atom, and JSON feeds with rich HTML
previews, optional full-content entries, and pagination support. Drop it in
book.toml and it just works, perfect for blogs, docs sites, or any mdBook
you want to publish a feed for.
Features
- Hybrid HTML preview built from the first paragraphs of each chapter, with
fallback to a frontmatter
descriptionwhen the body is short or missing - Optional full-content entries instead of previews
- Optional pagination (
rss2.xml,rss3.xml, …) to keep the main feed small - Optional Atom (
atom.xml) and JSON Feed (feed.json) output alongside RSS - Reads
date:from frontmatter (RFC3339 orYYYY-MM-DD), falling back to file modification time - Works with or without frontmatter; zero-config by default
Installation
Atom and JSON Feed output are gated behind cargo features, since they pull in extra dependencies most users won't need. Pick what you want at install time:
# RSS only (default)
# RSS + Atom + JSON Feed
| Feature | Enables |
|---|---|
atom |
atom.xml output |
json-feed |
feed.json output |
If you set atom = true or json-feed = true in book.toml without
installing the matching feature, the preprocessor prints a warning to stderr
and skips that output rather than failing the build.
Usage
[]
= "your-title"
= "your-author"
= "src"
[]
= ["html"]
# full-preview = true # use the whole chapter as the preview, not an excerpt
# atom = true # also write atom.xml (needs the `atom` feature)
# json-feed = true # also write feed.json (needs the `json-feed` feature)
# paginated = true # split into rss.xml, rss2.xml, ... once max-items is exceeded
# max-items = 4
[]
= "https://your-user.github.io/"
renderers = ["html"] ensures the preprocessor only runs for HTML builds.
- Omitting
titlefalls back toMy mdbook; omittingsite-urlfalls back tohttps://example.com. Setsite-urlto your site's real public base URL. - With the config above, the feed is published at
https://your-user.github.io/rss.xml. full-preview = truelets readers read the whole entry in their feed reader without visiting the site — better privacy, fewer tracked page views.
Pagination
Enable with paginated = true and max-items = N in [preprocessor.rss-feed].
- Chapters are sorted by frontmatter
date(newest first), falling back to file modification time. rss.xmlholds the newestNitems; older items spill intorss2.xml,rss3.xml, etc.- If
atom/json-feedare enabled, their paginated pages mirror the RSS pages (atom2.xml,feed2.json, …). Atom pages includerel="next"/rel="prev"links; JSON Feed pages includenext_url, per the JSON Feed 1.1 spec.
Pagination relies on accurate date: frontmatter — without it, ordering
falls back to file timestamps, which may not match publish order.
To turn pagination back off: set paginated = false and max-items = 0,
delete any rss2.xml, atom2.xml, feed2.json (etc.) files from src/,
and run mdbook clean before rebuilding.
Frontmatter
Frontmatter is optional. Without it, entries fall back to the chapter title and a date derived from the file's mtime. With it, the same block drives all three feed formats:
title: Debugging NixOS modules
date:
author: saylesss88
description: This chapter covers debugging NixOS modules, focusing on tracing
module options and evaluating merges.
- Dates must be RFC3339 or
YYYY-MM-DDto sort correctly; add them to every chapter for reliable chronological order. - A loader like mdbook-content-loader can enforce typed, validated frontmatter so dates are always present — this makes pagination ordering more reliable, but isn't required.
How the preview is built
By default, the preview comes from the first 2–3 <p> blocks of the
rendered chapter (up to ~800 characters), skipping any leading
non-paragraph content like lists or details blocks. Set description in
frontmatter to override this, that text is used whenever the chapter body
is empty or very short. Omit description if you always want the preview
pulled from the body.
Syndication formats
- RSS 2.0 (
rss.xml): widest reader support; good default. - Atom 1.0 (
atom.xml, needs theatomfeature): stricter spec, less ambiguity than RSS. - JSON Feed 1.1 (
feed.json, needs thejson-feedfeature): plain JSON, easy to consume from custom tooling without an XML parser.
privacy-book
https://mako088.github.io/
An mdBook-generated site
mdbook-rss-feed 1.4.1
Encrypted DNS on Arch
https://mako088.github.io/arch/enc_dns.html
https://mako088.github.io/arch/enc_dns.html
Fri, 28 Nov 2025 00:00:00 +0000
Truncated for brevity.
privacy-book
https://mako088.github.io/atom.xml
An mdBook-generated site
Encrypted DNS on Arch
https://mako088.github.io/arch/enc_dns.html
2025-11-28T00:00:00+00:00
<p>NOTE: There are many other ways...</p>
Truncated for brevity.
Truncated for brevity.
Using injected snippets as previews
If you use preprocessors like
mdbook-content-loader or
mdbook-content-collections
to inject intro snippets into chapters, those snippets are ordinary Markdown
by the time mdbook-rss-feed sees them. Since the preview is built from the
first real <p> blocks in the rendered chapter, an injected intro paragraph
becomes the feed preview automatically — no extra config needed.
Combined with typed frontmatter from a content loader, you get consistent ordering between your book's index and the RSS feed, plus cleaner previews when snippets are well-structured.
Hiding frontmatter in rendered HTML
mdBook doesn't strip YAML frontmatter on its own, so the raw block can leak into the rendered HTML. Use mdbook-frontmatter-strip to remove it.
RSS button for the mdBook header
Add to book.toml:
= ["theme/rss-button.css"]
= ["theme/rss-button.js"]
theme/rss-button.css:
}
}
}
theme/rss-button.js:
document.;
This pins a small RSS icon to the top right of the book, linking to your feed.