sitemap generates URL
This commit is contained in:
parent
189510c008
commit
0a8d36dc9f
7 changed files with 33 additions and 15 deletions
|
@ -66,6 +66,7 @@ pub mod routes {
|
|||
pub sitekey: Sitekey,
|
||||
pub notifications: &'static str,
|
||||
pub settings: Settings,
|
||||
pub stats: &'static str,
|
||||
}
|
||||
|
||||
impl Panel {
|
||||
|
@ -75,10 +76,11 @@ pub mod routes {
|
|||
sitekey: Sitekey::new(),
|
||||
notifications: "/notifications",
|
||||
settings: Settings::new(),
|
||||
stats: "/stats",
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn get_sitemap() -> [&'static str; 5] {
|
||||
pub const fn get_sitemap() -> [&'static str; 6] {
|
||||
const PANEL: Panel = Panel::new();
|
||||
const S: [&str; 2] = Sitekey::get_sitemap();
|
||||
|
||||
|
@ -88,6 +90,7 @@ pub mod routes {
|
|||
S[0],
|
||||
S[1],
|
||||
Settings::get_sitemap()[0],
|
||||
PANEL.stats,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,12 +26,19 @@ use crate::PAGES;
|
|||
#[template(path = "sitemap.html")]
|
||||
struct IndexPage {
|
||||
urls: [&'static str; 7],
|
||||
domain: &'static str,
|
||||
}
|
||||
|
||||
impl Default for IndexPage {
|
||||
fn default() -> Self {
|
||||
let urls = Routes::get_sitemap();
|
||||
Self { urls }
|
||||
let domain = if crate::SETTINGS.server.domain.ends_with('/') {
|
||||
&crate::SETTINGS.server.domain[0..crate::SETTINGS.server.domain.len() - 1]
|
||||
} else {
|
||||
&crate::SETTINGS.server.domain
|
||||
};
|
||||
|
||||
Self { urls, domain }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,10 @@ pub mod assets {
|
|||
FILES.get("./static/cache/img/icon-trans.png").unwrap(),
|
||||
"Logo"
|
||||
);
|
||||
pub static ref BAR_CHART: Img = (
|
||||
FILES.get("./static/cache/img/svg/bar-chart.svg").unwrap(),
|
||||
"Statistics"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
1
static/cache/img/svg/bar-chart.svg
vendored
Normal file
1
static/cache/img/svg/bar-chart.svg
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bar-chart"><line x1="12" y1="20" x2="12" y2="10"></line><line x1="18" y1="20" x2="18" y2="4"></line><line x1="6" y1="20" x2="6" y2="16"></line></svg>
|
After Width: | Height: | Size: 353 B |
|
@ -1,4 +0,0 @@
|
|||
<svg>
|
||||
<title><=. ALT.></title>
|
||||
<use xlink:href="<=. PATH .>#icon"></use>
|
||||
</svg>
|
Before Width: | Height: | Size: 84 B |
|
@ -30,7 +30,14 @@
|
|||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="secondary-menu__item">
|
||||
<a class="secondary-menu__item-link" href="<.= crate::PAGES.panel.sitekey.list .>">
|
||||
<img class="secondary-menu__icon" src="<.= crate::BAR_CHART.0 .>" alt="<.= crate::BAR_CHART.1 .>" />
|
||||
<div class="secondary-menu__item-name">
|
||||
Statistics
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="secondary-menu__item">
|
||||
<a class="secondary-menu__item-link" href="<.= crate::PAGES.panel.settings.home .>">
|
||||
<img class="secondary-menu__icon" src="<.= crate::SETTINGS_ICON.0 .>" alt="<.= crate::SETTINGS_ICON.1 .>" />
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<. for url in urls.iter(){ .>
|
||||
<url>
|
||||
<loc><.= url .></loc>
|
||||
<lastmod><.= crate::COMPILED_DATE .></lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<. } .>
|
||||
<. for url in urls.iter(){ .>
|
||||
<url>
|
||||
<loc>http://<.= domain .><.= url .></loc>
|
||||
<lastmod><.= crate::COMPILED_DATE .></lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<. } .>
|
||||
</urlset>
|
||||
|
|
Loading…
Reference in a new issue