add color to index

This commit is contained in:
slonkazoid 2024-07-01 03:16:17 +03:00
parent 3623b61fbe
commit 38d93a66ba
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM
2 changed files with 8 additions and 1 deletions

View file

@ -34,6 +34,7 @@ struct IndexTemplate<'a> {
rss: bool,
df: &'a DateFormat,
js: bool,
color: Option<&'a str>,
}
#[derive(Template)]
@ -70,6 +71,7 @@ async fn index<'a>(
rss: config.rss.enable,
df: &config.date_format,
js: config.js_enable,
color: config.default_color.as_deref(),
}
.into_response())
}

View file

@ -7,11 +7,16 @@
<meta name="description" content="{{ title }}" />
<meta property="og:title" content="{{ title }}" />
<meta property="og:description" content="{{ description }}" />
{% match color %} {% when Some with (color) %}
<meta name="theme-color" content="{{ color }}" />
{% when None %} {% endmatch %}
<title>{{ title }}</title>
<link rel="stylesheet" href="/static/style.css" />
{% if rss %}
<link rel="alternate" type="application/rss+xml" title="{{ title }}" href="/feed.xml" />
{% endif %} {% if js %}
{% endif %}
<!-- prettier-br -->
{% if js %}
<script src="/static/main.js" defer></script>
{% endif %}
</head>