Skip to main content

Crate use_sitemap

Crate use_sitemap 

Source
Expand description

§use-sitemap

Sitemap entry primitives and XML-safe formatting helpers for RustUse.

§Example

use use_sitemap::{ChangeFrequency, Priority, SitemapEntry, SitemapUrl};

let entry = SitemapEntry::new(SitemapUrl::new("https://example.com/").unwrap())
    .with_change_frequency(ChangeFrequency::Weekly)
    .with_priority(Priority::new(0.8).unwrap());

assert!(entry.to_url_xml().contains("<changefreq>weekly</changefreq>"));

§Scope

  • Sitemap URLs, entries, index entries, change frequency, priority, last-modified labels, and XML escaping.

§Non-goals

  • A full XML framework, file IO, crawling, or URL discovery.

§License

Licensed under either Apache-2.0 or MIT, at your option.

Structs§

LastModified
Last-modified label for sitemap entries.
Priority
Sitemap priority value in the inclusive 0.0..=1.0 range.
SitemapEntry
A sitemap URL entry.
SitemapIndexEntry
A sitemap index entry.
SitemapUrl
A validated sitemap URL.

Enums§

ChangeFrequency
Sitemap change frequency label.
SitemapValueError
Error returned by sitemap primitive constructors.

Functions§

escape_xml
Escapes the XML characters required by sitemap formatting helpers.