1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! A Rust library to generate URL, Index, Image, Video, and News sitemaps.
//!
//! ## Example
//!
//! `cargo run --example generate_url_sitemap`
//!
//! ```rust
//! use chrono::{DateTime, FixedOffset, NaiveDate};
//! use sitemap_rs::url::{ChangeFrequency, Link, Url};
//! use sitemap_rs::url_set::UrlSet;
//!
//! let urls: Vec<Url> = vec![
//! Url::builder(String::from("https://www.toddgriffin.me/"))
//! .links(vec![Link::new(
//! "de".to_owned(),
//! "https://www.toddgriffin.me/de".to_owned(),
//! )])
//! .last_modified(DateTime::from_naive_utc_and_offset(
//! NaiveDate::from_ymd_opt(1998, 1, 15)
//! .unwrap()
//! .and_hms_opt(4, 20, 0)
//! .unwrap(),
//! FixedOffset::east_opt(0).unwrap(),
//! ))
//! .change_frequency(ChangeFrequency::Monthly)
//! .priority(0.69)
//! .build()
//! .unwrap(),
//! ];
//!
//! let url_set: UrlSet = UrlSet::new(urls).unwrap();
//! let mut buf: Vec<u8> = Vec::<u8>::new();
//! url_set.write(&mut buf).unwrap();
//! println!("{}", String::from_utf8(buf).unwrap());
//! ```
//!
//! Generated XML:
//! ```xml
//! <?xml version="1.0" encoding="UTF-8"?>
//! <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
//! <url>
//! <loc>https://www.toddgriffin.me/</loc>
//! <xhtml:link rel="alternate" hreflang="de" href="https://www.toddgriffin.me/de" />
//! <lastmod>1998-01-15T04:20:00+00:00</lastmod>
//! <changefreq>monthly</changefreq>
//! <priority>0.69</priority>
//! </url>
//! </urlset>
//! ```
//!
//! For more examples, check out the `examples` directory within the repository.
use SecondsFormat;
pub const NAMESPACE: &str = "http://www.sitemaps.org/schemas/sitemap/0.9";
pub const XHTML_NAMESPACE: &str = "http://www.w3.org/1999/xhtml";
pub const IMAGE_NAMESPACE: &str = "http://www.google.com/schemas/sitemap-image/1.1";
pub const VIDEO_NAMESPACE: &str = "http://www.google.com/schemas/sitemap-video/1.1";
pub const NEWS_NAMESPACE: &str = "http://www.google.com/schemas/sitemap-news/0.9";
pub const ENCODING: &str = "UTF-8";
pub const RFC_3339_SECONDS_FORMAT: SecondsFormat = Secs;
pub const RFC_3339_USE_Z: bool = false;