pyssg is pre-1.0 and under active development - APIs, config, and themes may change.
pyssg.plugins.sitemap

1 min read

pyssg.plugins.sitemap

Sitemap plugin.

During evaluate_collections it scans every document page in the graph and materializes a single virtual page at /sitemap.xml whose body is a urlset listing each page's absolute URL (base_url + page url) and an optional <lastmod> derived from the document's frontmatter date.

This is the "summarizer fan-in" feature: the output depends on the whole set of document pages. Recomputation is deterministic (URLs sorted) and reads only declared inputs (no clock), so two builds are byte-identical and an incremental rebuild reuses cached output whenever the projection is unchanged.

render_sitemap_xml(entries: list[tuple[str, str | None]]) -> str

Build the urlset XML body from (url, lastmod) entries.

build_sitemap(build: Build) -> None

Create or update the virtual /sitemap.xml page in place.

class SitemapPlugin

Built-in sitemap.xml generator.

SitemapPlugin.apply(self, builder: Builder) -> None

sitemap() -> SitemapPlugin

Factory used in pyssg.config.py.