Struct sitemap_xml_writer::Sitemap
source · pub struct Sitemap<'a> { /* private fields */ }
Expand description
A builder for sitemap
entry.
Examples
Sitemap::loc("http://www.example.com/sitemap1.xml.gz")?
.lastmod("2004-10-01T18:23:17+00:00")?;
ⓘ
Sitemap::loc(::url::Url::parse("http://www.example.com/sitemap1.xml.gz")?)?
.lastmod(::chrono::DateTime::parse_from_rfc3339("2004-10-01T18:23:17+00:00")?)?;
ⓘ
Sitemap::loc(::url::Url::parse("http://www.example.com/sitemap1.xml.gz")?)?
.lastmod(::time::macros::datetime!(2004-10-01 18:23:17+00:00))?;
Implementations§
source§impl<'a> Sitemap<'a>
impl<'a> Sitemap<'a>
sourcepub fn loc<S>(loc: S) -> Result<Self, Error>where
S: TryInto<Loc<'a>>,
pub fn loc<S>(loc: S) -> Result<Self, Error>where S: TryInto<Loc<'a>>,
Builds a sitemap
entry with the specified URL as the content of the
loc
child entry.
If you want to ensure that the URL is Valid, use ::url::Url
. If you
use &str, the URL is assumed to be valid and only the length check and
XML entity escaping are performed.
Examples
Sitemap::loc("http://www.example.com/sitemap1.xml.gz")?;
ⓘ
let url = ::url::Url::parse("http://www.example.com/sitemap1.xml.gz")?;
Sitemap::loc(url)?;
sourcepub fn lastmod<S>(self, s: S) -> Result<Self, Error>where
S: TryInto<Lastmod<'a>>,
pub fn lastmod<S>(self, s: S) -> Result<Self, Error>where S: TryInto<Lastmod<'a>>,
Changes the lastmod
child entry to the specified date or datetime.
Examples
Sitemap::loc("http://www.example.com/sitemap1.xml.gz")?
.lastmod("2004-10-01T18:23:17+00:00")?;
ⓘ
Sitemap::loc("http://www.example.com/sitemap1.xml.gz")?
.lastmod(::chrono::DateTime::parse_from_rfc3339("2004-10-01T18:23:17+00:00")?)?;
ⓘ
Sitemap::loc("http://www.example.com/sitemap1.xml.gz")?
.lastmod(::time::macros::datetime!(2004-10-01 18:23:17+00:00))?;