Minimal, pipeline-friendly XML sitemap generator.
Build a sitemap by starting with new/1, adding entries via add/2 or
add/3, and rendering to XML with generate/1.
Usage
SitemapBuilder.new("https://example.com")
|> SitemapBuilder.add(%SitemapBuilder{url: "/en", lastmod: ~D[2026-01-01]})
|> SitemapBuilder.add(posts, &%SitemapBuilder{url: "/posts/#{&1.slug}", lastmod: &1.updated_at})
|> SitemapBuilder.generate()Each entry is a %SitemapBuilder{} struct with two required fields:
Summary
Functions
Adds a pre-built %SitemapBuilder{} entry directly.
Adds a list of items or a single item, mapping each to a %SitemapBuilder{} entry via fun.
Renders the sitemap to an XML string.
Creates a new builder for the given host URL.