Crates.io | sitemap-gen |
lib.rs | sitemap-gen |
version | 0.0.1 |
source | src |
created_at | 2024-10-10 11:05:35.934179 |
updated_at | 2024-10-10 11:05:35.934179 |
description | A robust Rust library designed for efficient generation and optimization of sitemaps, supporting various formats and customizations. |
homepage | https://sitemap-gen.co/ |
repository | https://github.com/sebastienrousseau/sitemap-gen |
max_upload_size | |
id | 1403712 |
size | 199,396 |
A fast and efficient Rust library for generating and validating XML sitemaps.
• Website • Documentation • Report Bug • Request Feature • Contributing Guidelines
The sitemap-gen
library provides a powerful solution for generating and optimizing XML sitemaps, essential for enhancing SEO and improving website visibility. It supports the creation of sitemaps for websites of any scale, with built-in validation and performance optimizations to ensure that your sitemaps comply with web standards.
Add this to your Cargo.toml
to start using sitemap-gen
:
[dependencies]
sitemap-gen = "0.0.1"
Here’s an example of how to generate a sitemap:
use sitemap_gen::{Sitemap, ChangeFreq, SiteMapData};
use url::Url;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new sitemap
let mut sitemap = Sitemap::new();
// Add entries
let entry = SiteMapData {
loc: Url::parse("https://example.com/")?,
lastmod: "2023-10-01".to_string(),
changefreq: ChangeFreq::Weekly,
};
sitemap.add_entry(entry)?;
// Generate the XML
let xml = sitemap.to_xml()?;
println!("{}", xml);
Ok(())
}
Full API documentation is available at docs.rs/sitemap-gen.
To explore more examples, clone the repository and run the following command:
cargo run --example example_name
We welcome contributions from the community! Please check our contributing guidelines and feel free to submit issues or pull requests.
This project is licensed under either of the following licenses:
You can choose which one you prefer.
Special thanks to all contributors who have helped build and improve the sitemap-gen
library.