add entity escaping to the example

This commit is contained in:
Edgar 2021-02-01 11:04:40 +01:00
parent 4d3dbedd14
commit 40713ae38b
2 changed files with 17 additions and 0 deletions

View file

@ -37,6 +37,16 @@ fn main() {
),
});
// Entity escaping
sitemap.urls.push(Url {
loc: "https://edgarluque.com/blog/test&id='<test>'",
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 = sitemap.into_str();
println!("{}", result);
}

View file

@ -240,6 +240,13 @@ mod tests {
lastmod: None,
});
sitemap.urls.push(Url {
loc: "https://domain.com/bb&id='<test>'",
changefreq: None,
priority: None,
lastmod: None,
});
sitemap.into_str();
}