A rust library to generate sitemaps.
Go to file
2024-06-19 17:51:07 +02:00
.github try 2024-06-19 17:50:25 +02:00
benches remove unused struct and put its functions as top level 2021-12-14 08:52:40 +01:00
examples upd deps 2023-01-11 14:23:59 +01:00
src update deps 2023-12-29 12:40:20 +01:00
.gitignore add ci 2024-06-19 17:30:16 +02:00
Cargo.toml update deps 2024-05-26 16:56:21 +02:00
LICENSE add more author info to the license 2021-02-01 10:49:54 +01:00
oranda.json fix 2024-06-19 17:51:07 +02:00
README.md fix 2024-06-19 17:46:03 +02:00

sitewriter

A library to generate sitemaps.

Version Downloads License Rust Docs

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