Skip to main content

Crate sitemap_gen

Crate sitemap_gen 

Source
Expand description

Sitemap Gen logo

Sitemap Gen

A Rust library for efficient generation and optimization of sitemaps.

Build Crates.io Docs.rs Coverage lib.rs


§Install

cargo add sitemap-gen

Or add to Cargo.toml:

[dependencies]
sitemap-gen = "0.0.7"

You need Rust 1.56.0 or later. Works on macOS, Linux, and Windows.


§Overview

Sitemap Gen generates and optimises XML sitemaps for search engine indexing.

  • Standard sitemaps from URL lists
  • Sitemap index for large sites
  • News, image, and video sitemap extensions
  • Compression for optimised delivery

§Features

Sitemap generationGenerate XML sitemaps from URL lists
Multiple formatsStandard sitemap, sitemap index, news, image, and video
OptimisationCompress and optimise sitemaps for search engines
ValidationValidate URLs and sitemap structure
CLICommand-line interface for batch generation

§Usage

use sitemap_gen::{ChangeFreq, SiteMapData, Sitemap};
use url::Url;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut sitemap = Sitemap::new();

    sitemap.add_entry(SiteMapData {
        loc: Url::parse("https://example.com/")?,
        lastmod: "2026-06-21".to_string(),
        changefreq: ChangeFreq::Weekly,
    })?;

    let xml = sitemap.to_xml()?;
    println!("{}", xml);
    Ok(())
}

§Development

cargo build        # Build the project
cargo test         # Run all tests
cargo clippy       # Lint with Clippy
cargo fmt          # Format with rustfmt

See CONTRIBUTING.md for setup, signed commits, and PR guidelines.


THE ARCHITECT ᴫ Sebastien Rousseau THE ENGINE ᵞ EUXIS ᴫ Enterprise Unified Execution Intelligence System


§License

Dual-licensed under Apache 2.0 or MIT, at your option.

Back to Top

A Rust library for generating and managing sitemaps.

This crate provides functionality to create, modify, and serialize XML sitemaps according to the Sitemaps XML format. It includes support for handling various sitemap-specific data types and error conditions.

Re-exports§

pub use error::SitemapError;
pub use sitemap::convert_date_format;
pub use sitemap::create_site_map_data;
pub use sitemap::ChangeFreq;
pub use sitemap::SiteMapData;
pub use sitemap::Sitemap;

Modules§

error
Contains error types specific to sitemap operations.
prelude
A prelude module for convenient importing of commonly used items.
sitemap
Provides the core functionality for creating and managing sitemaps.
utils
Utility functions and helper methods for sitemap operations.

Type Aliases§

SitemapResult
Result type alias for sitemap operations.