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

View file

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