Module

postprocess.rss

RSS feed generation for content syndication.

Generates RSS/Atom feeds for blog content, enabling readers to subscribe to site updates via RSS readers. Creates rss.xml with recent pages sorted by date.

Key Concepts:

  • RSS format: Standard RSS 2.0 format for content syndication
  • Recent pages: Limited to 20 most recent pages with dates
  • Date sorting: Pages sorted by date (newest first)
  • RFC 822 dates: Standard date formatting for RSS feeds

Related Modules:

  • bengal.orchestration.postprocess: Post-processing orchestration
  • bengal.core.site: Site container with pages
  • bengal.core.page: Page objects with dates

See Also:

  • bengal/postprocess/rss.py: RSSGenerator for RSS generation
  • https: //www.rssboard.org/rss-specification: RSS 2.0 specification

Classes

RSSGenerator
Generates RSS/Atom feeds for content syndication. Creates rss.xml files with recent pages sorted b…
3

Generates RSS/Atom feeds for content syndication.

Creates rss.xml files with recent pages sorted by date, enabling readers to subscribe to site updates via RSS readers. Supports i18n per-locale feeds and respects page visibility settings.

Creation:

Direct instantiation: RSSGenerator(site)
  • Created by PostprocessOrchestrator for RSS generation
  • Requires Site instance with rendered pages

Attributes

Name Type Description
site

Site instance with pages and configuration

logger

Logger instance for RSS generation events

Relationships
  • Used by: PostprocessOrchestrator for RSS generation - Uses: Site for page access and configuration
Features
  • Includes title, link, description for each item - Sorted by date (newest first) - Limited to 20 most recent items - RFC 822 date formatting - i18n per-locale feeds (if i18n enabled) - Respects page visibility (draft, rss visibility)

Methods 1

generate
Generate and write rss.xml to output directory. Filters pages with dates, sort…
0 None
def generate(self) -> None

Generate and write rss.xml to output directory.

Filters pages with dates, sorts by date (newest first), limits to 20 items, and writes RSS feed atomically to prevent corruption.

If no pages with dates exist, logs info and skips generation.

Internal Methods 2
__init__
Initialize RSS generator.
1 None
def __init__(self, site: Any) -> None

Initialize RSS generator.

Parameters 1
site Any

Site instance

_indent
Add indentation to XML for readability.
2 None
def _indent(self, elem: ET.Element, level: int = 0) -> None

Add indentation to XML for readability.

Parameters 2
elem ET.Element

XML element to indent

level int

Current indentation level