sitemap-rs

A Rust library to generate URL, index, image, video, and news XML sitemaps.

Library
Cargo
v0.4.0
34stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
27/100Needs Attention
Development Activity0
Maintenance20
Community20
Maturity56
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture82
Code Quality85
Innovation68
Learning Curve82

sitemap-rs is a Rust library for generating every flavor of XML sitemap: standard URL sitemaps, sitemap index files, and the specialized image, video, and news extensions used by Google and Bing. Rather than letting malformed sitemaps slip through to a search console, it enforces the protocol’s constraints — URL counts, location length, priority ranges, and per-type limits — at struct construction time, so invalid data fails fast in your code instead of silently degrading your SEO.

What You Get

  • Builders for URL, index, image, video, and news sitemaps that serialize to spec-compliant XML
  • Compile-in validation that rejects oversized location strings, excess URLs, and invalid priorities at struct creation
  • A safe, dependency-light API with unsafe code forbidden and strict clippy lints enforced

Common Use Cases

  • Generating sitemaps for a Rust-powered website or static-site generator at build time
  • Producing image, video, or Google News sitemaps with their extension-specific fields
  • Splitting a large site across a sitemap index when a single file would exceed protocol limits

Under The Hood

Architecture - The crate models each sitemap type as its own module (url_set, sitemap_index, image, video, news) with a builder pattern for the record types that carry many optional fields, notably UrlBuilder and VideoBuilder. Validation lives in dedicated error enums (UrlError, UrlSetError, SitemapIndexError, VideoError) returned at build time, so a UrlSet cannot be constructed in an invalid state. Tech Stack - It targets the Rust 2024 edition (rust-version 1.89) and relies on the xml-builder and chrono crates for serialization and date handling; the build is linted aggressively with clippy pedantic/cargo groups set to deny. Code Quality - The repository forbids unsafe_code at the crate level, enforces an extensive clippy configuration, and carries an integration test suite under tests/ covering each sitemap variant. API Design - The builder-plus-validation approach makes the happy path ergonomic while surfacing spec violations as typed Result errors, so misuse is caught by the compiler and at runtime rather than by an external search console.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search