create & use logo
This commit is contained in:
@@ -67,6 +67,10 @@ pub static STORE: LazyLock<StaticAssetStore> = LazyLock::new(|| {
|
||||
"password-toggle.js" => "../static/password-toggle.js",
|
||||
"htmx.min.js" => "../static/htmx.min.js",
|
||||
"htmx-ws.min.js" => "../static/htmx-ws.min.js",
|
||||
"favicon.ico" => "../static/favicon.ico",
|
||||
"favicon-32x32.png" => "../static/favicon-32x32.png",
|
||||
"apple-touch-icon.png" => "../static/apple-touch-icon.png",
|
||||
"logo.svg" => "../static/logo.svg",
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+5
-2
@@ -342,8 +342,11 @@ async fn static_asset(Path(path): Path<String>) -> Response {
|
||||
let Some(asset) = assets::STORE.get(&path) else {
|
||||
return StatusCode::NOT_FOUND.into_response();
|
||||
};
|
||||
let mime = match path.as_str() {
|
||||
"style.css" => "text/css",
|
||||
let mime = match path.rsplit('.').next() {
|
||||
Some("css") => "text/css",
|
||||
Some("ico") => "image/x-icon",
|
||||
Some("png") => "image/png",
|
||||
Some("svg") => "image/svg+xml",
|
||||
_ => "application/javascript",
|
||||
};
|
||||
let mut response = ([(header::CONTENT_TYPE, mime)], asset.data).into_response();
|
||||
|
||||
+4
-1
@@ -1308,13 +1308,16 @@ fn page(title: &str, user: Option<&User>, content: Markup) -> Markup {
|
||||
meta charset="utf-8";
|
||||
meta name="viewport" content="width=device-width, initial-scale=1";
|
||||
title { (title) " · Sustenance" }
|
||||
link rel="icon" href=(crate::assets::url("favicon.ico")) sizes="any";
|
||||
link rel="icon" type="image/png" href=(crate::assets::url("favicon-32x32.png")) sizes="32x32";
|
||||
link rel="apple-touch-icon" href=(crate::assets::url("apple-touch-icon.png"));
|
||||
link rel="stylesheet" href=(crate::assets::url("style.css"));
|
||||
script src=(crate::assets::url("htmx.min.js")) {}
|
||||
script src=(crate::assets::url("htmx-ws.min.js")) {}
|
||||
}
|
||||
body hx-boost="true" {
|
||||
header class="site-header" {
|
||||
a class="brand" href="/lists" { span class="brand-mark" { "S" } "Sustenance" }
|
||||
a class="brand" href="/lists" { img class="brand-mark" src=(crate::assets::url("logo.svg")) alt="Sustenance logo"; "Sustenance" }
|
||||
@if let Some(user) = user {
|
||||
nav class="site-nav" {
|
||||
a href="/lists" { "Lists" }
|
||||
|
||||
Reference in New Issue
Block a user