Merge pull request #71 from hay-kot/feat/add-site-favicon
feat: add site favicon
This commit is contained in:
commit
ec4d764f5a
3 changed files with 19 additions and 0 deletions
|
@ -8,6 +8,12 @@ struct WaterCSS<'a> {
|
|||
_marker: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "favicon.svg", escape = "none")]
|
||||
struct Favicon<'a> {
|
||||
_marker: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
#[get("/static/{resource}")]
|
||||
pub async fn static_resources(resource_id: web::Path<String>) -> HttpResponse {
|
||||
match resource_id.into_inner().as_str() {
|
||||
|
@ -18,6 +24,13 @@ pub async fn static_resources(resource_id: web::Path<String>) -> HttpResponse {
|
|||
.render()
|
||||
.unwrap(),
|
||||
),
|
||||
"favicon.svg" => HttpResponse::Ok().content_type("image/svg+xml").body(
|
||||
Favicon {
|
||||
_marker: Default::default(),
|
||||
}
|
||||
.render()
|
||||
.unwrap(),
|
||||
),
|
||||
_ => HttpResponse::NotFound().content_type("text/html").finish(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue