Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edg-l/sitewriter
A rust library to generate sitemaps.
https://github.com/edg-l/sitewriter
rust rust-lang sitemap sitemap-generator writer xml
Last synced: 3 months ago
JSON representation
A rust library to generate sitemaps.
- Host: GitHub
- URL: https://github.com/edg-l/sitewriter
- Owner: edg-l
- License: mit
- Created: 2020-11-22T14:43:02.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-29T13:06:16.000Z (about 1 year ago)
- Last Synced: 2024-05-03T08:17:53.724Z (9 months ago)
- Topics: rust, rust-lang, sitemap, sitemap-generator, writer, xml
- Language: Rust
- Homepage: https://docs.rs/sitewriter
- Size: 65.4 KB
- Stars: 25
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# sitewriter
### A library to generate sitemaps.
[![Version](https://img.shields.io/crates/v/sitewriter)](https://crates.io/crates/sitewriter)
[![Downloads](https://img.shields.io/crates/d/sitewriter)](https://crates.io/crates/sitewriter)
[![License](https://img.shields.io/crates/l/sitewriter)](https://crates.io/crates/sitewriter)
![Rust](https://github.com/edg-l/sitewriter/workflows/Rust/badge.svg)
[![Docs](https://docs.rs/sitewriter/badge.svg)](https://docs.rs/sitewriter)It uses the [quick-xml](https://github.com/tafia/quick-xml) so it should be fast.
### Example
```rust
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=''"
.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/](https://web.crev.dev/rust-reviews/crates/) \
Than install the CLI [cargo-crev](https://github.com/crev-dev/cargo-crev)\. Follow the [Getting Started guide](https://github.com/crev-dev/cargo-crev/blob/master/cargo-crev/src/doc/getting_started.md). \
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](https://crates.io/crates/cargo_crev_reviews) to write reviews easily.License: MIT