sova_meta/
sitemap_config.rs1#[derive(Debug, Clone)]
5pub struct SitemapConfig {
6 pub public_url: Option<String>,
7 pub path: String,
9}
10
11impl SitemapConfig {
12 pub fn sitemap_url(&self) -> Option<String> {
13 let base = self.public_url.as_ref()?;
14 let base = base.trim_end_matches('/');
15 let path = if self.path.starts_with('/') {
16 self.path.clone()
17 } else {
18 format!("/{}", self.path)
19 };
20 Some(format!("{base}{path}"))
21 }
22}
23
24impl Default for SitemapConfig {
25 fn default() -> Self {
26 Self {
27 public_url: None,
28 path: "/sitemap.xml".into(),
29 }
30 }
31}