24 releases (5 stable)

1.0.4 Dec 29, 2023
1.0.3 Oct 30, 2023
1.0.2 Jun 19, 2023
1.0.0 Feb 26, 2023
0.2.4 Nov 27, 2020

#588 in Web programming

Download history 156/week @ 2023-12-06 96/week @ 2023-12-13 4/week @ 2023-12-20 2/week @ 2023-12-27 5/week @ 2024-01-17 9/week @ 2024-02-21 40/week @ 2024-02-28 33/week @ 2024-03-06 158/week @ 2024-03-13

234 downloads per month
Used in 3 crates

MIT license

16KB
181 lines

sitewriter

A library to generate sitemaps.

Version Downloads License Rust Docs crev reviews

It uses the quick-xml so it should be fast.

Example

use chrono::prelude::*;
use sitewriter::{ChangeFreq, UrlEntry, UrlEntryBuilder};

let urls = vec![
    UrlEntryBuilder::default()
        .loc("https://edgarluque.com/projects".parse().unwrap())
        .build()
        .unwrap(),
    UrlEntry {
        loc: "https://edgarluque.com/".parse().unwrap(),
        changefreq: Some(ChangeFreq::Daily),
        priority: Some(1.0),
        lastmod: Some(Utc::now()),
    },
    UrlEntry {
        loc: "https://edgarluque.com/blog".parse().unwrap(),
        changefreq: Some(ChangeFreq::Weekly),
        priority: Some(0.8),
        lastmod: Some(Utc::now()),
    },
    UrlEntry {
        loc: "https://edgarluque.com/blog/sitewriter".parse().unwrap(),
        changefreq: Some(ChangeFreq::Never),
        priority: Some(0.5),
        lastmod: Some(Utc.ymd(2020, 11, 22).and_hms(15, 10, 15)),
    },
    UrlEntry {
        loc: "https://edgarluque.com/blog/some-future-post"
            .parse()
            .unwrap(),
        changefreq: Some(ChangeFreq::Never),
        priority: Some(0.5),
        lastmod: Some(
            Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()),
        ),
    },
    // Entity escaping
    UrlEntry {
        loc: "https://edgarluque.com/blog/test&id='<test>'"
            .parse()
            .unwrap(),
        changefreq: Some(ChangeFreq::Never),
        priority: Some(0.5),
        lastmod: Some(
            Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()),
        ),
    },
];

let result = sitewriter::generate_str(&urls);
println!("{}", result);

CREV - Rust code reviews - Raise awareness

Please, spread this info !
Open source code needs a community effort to express trustworthiness.
Start with reading the reviews of the crates you use on web.crev.dev/rust-reviews/crates/
Than install the CLI cargo-crev. Follow the Getting Started guide.
On your Rust project, verify the trustworthiness of all dependencies, including transient dependencies with cargo crev verify
Write a new review !
Describe the crates you trust. Or warn about the crate versions you think are dangerous.
Help other developers, inform them and share your opinion.
Use cargo_crev_reviews to write reviews easily.

License: MIT

Dependencies

~5–13MB
~148K SLoC