Sitemap Gen logo # Sitemap Gen (sitemap-gen) A fast and efficient Rust library for generating and validating XML sitemaps.
[![Made With Love][made-with-rust]][08] [![Crates.io][crates-badge]][03] [![lib.rs][libs-badge]][01] [![Docs.rs][docs-badge]][04] [![Codecov][codecov-badge]][06] [![Build Status][build-badge]][07] [![GitHub][github-badge]][09] • [Website][00] • [Documentation][04] • [Report Bug][02] • [Request Feature][02] • [Contributing Guidelines][05]
## Overview 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. ## Features - **XML Sitemap Generation**: Efficiently generate well-structured XML sitemaps for websites. - **URL Management**: Add, validate, and normalize URLs easily within the sitemap. - **Change Frequency Support**: Specify how often pages are likely to change (daily, weekly, etc.). - **Last Modified Dates**: Include accurate timestamps for when pages were last modified. - **Validation**: Ensure that your sitemap adheres to size and URL limits as per SEO guidelines. - **Performance Optimizations**: Pre-allocate buffers and optimize memory usage for generating large sitemaps. - **Asynchronous Processing**: Leverage async functionality to generate sitemaps efficiently for larger sites. ## Installation Add this to your `Cargo.toml` to start using `sitemap-gen`: ```toml [dependencies] sitemap-gen = "0.0.1" ``` ## Usage Here’s an example of how to generate a sitemap: ```rust use sitemap_gen::{Sitemap, ChangeFreq, SiteMapData}; use url::Url; fn main() -> Result<(), Box> { // 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(()) } ``` ## Documentation Full API documentation is available at [docs.rs/sitemap-gen][04]. ## Examples To explore more examples, clone the repository and run the following command: ```shell cargo run --example example_name ``` ## Contributing We welcome contributions from the community! Please check our [contributing guidelines][05] and feel free to submit issues or pull requests. ## License This project is licensed under either of the following licenses: - [Apache License, Version 2.0][10] - [MIT License][11] You can choose which one you prefer. ## Acknowledgements Special thanks to all contributors who have helped build and improve the `sitemap-gen` library. [00]: https://sitemap-gen.co [01]: https://lib.rs/crates/sitemap-gen [02]: https://github.com/sebastienrousseau/sitemap-gen/issues [03]: https://crates.io/crates/sitemap-gen [04]: https://docs.rs/sitemap-gen [05]: https://github.com/sebastienrousseau/sitemap-gen/blob/main/CONTRIBUTING.md [06]: https://codecov.io/gh/sebastienrousseau/sitemap-gen [07]: https://github.com/sebastienrousseau/sitemap-gen/actions?query=branch%3Amain [08]: https://www.rust-lang.org/ [09]: https://github.com/sebastienrousseau/sitemap-gen [10]: https://www.apache.org/licenses/LICENSE-2.0 [11]: https://opensource.org/licenses/MIT [build-badge]: https://img.shields.io/github/actions/workflow/status/sebastienrousseau/sitemap-gen/release.yml?branch=main&style=for-the-badge&logo=github [codecov-badge]: https://img.shields.io/codecov/c/github/sebastienrousseau/sitemap-gen?style=for-the-badge&token=Q9KJ6XXL67&logo=codecov [crates-badge]: https://img.shields.io/crates/v/sitemap-gen.svg?style=for-the-badge&color=fc8d62&logo=rust [docs-badge]: https://img.shields.io/badge/docs.rs-sitemap--gen-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs [github-badge]: https://img.shields.io/badge/github-sebastienrousseau/sitemap--gen-8da0cb?style=for-the-badge&labelColor=555555&logo=github [libs-badge]: https://img.shields.io/badge/lib.rs-v0.0.1-orange.svg?style=for-the-badge [made-with-rust]: https://img.shields.io/badge/rust-f04041?style=for-the-badge&labelColor=c0282d&logo=rust