web: add SITE_SUBTITLE setting
parent
0e333af4e5
commit
90f8c9ad1a
|
@ -17,5 +17,6 @@ The following environment variables can be defined to configure various settings
|
|||
- `PORT`, default `3000`.
|
||||
- `PUBLIC_URL`, default `lists.mailpot.rs`.
|
||||
- `SITE_TITLE`, default `mailing list archive`.
|
||||
- `SITE_SUBTITLE`, default empty.
|
||||
- `ROOT_URL_PREFIX`, default empty.
|
||||
- `SSH_NAMESPACE`, default `lists.mailpot.rs`.
|
||||
|
|
|
@ -142,9 +142,9 @@ pub async fn ssh_signin(
|
|||
|
||||
let context = minijinja::context! {
|
||||
namespace => &state.public_url,
|
||||
title => state.site_title.as_ref(),
|
||||
site_title => state.site_title.as_ref(),
|
||||
site_subtitle => state.site_subtitle.as_ref(),
|
||||
page_title => "Log in",
|
||||
description => "",
|
||||
root_url_prefix => &root_url_prefix,
|
||||
ssh_challenge => token,
|
||||
timeout_left => timeout_left,
|
||||
|
|
|
@ -37,9 +37,9 @@ pub async fn help(
|
|||
},
|
||||
];
|
||||
let context = minijinja::context! {
|
||||
title => state.site_title.as_ref(),
|
||||
site_title => state.site_title.as_ref(),
|
||||
site_subtitle => state.site_subtitle.as_ref(),
|
||||
page_title => "Help & Documentation",
|
||||
description => "",
|
||||
root_url_prefix => &state.root_url_prefix,
|
||||
current_user => auth.current_user,
|
||||
messages => session.drain_messages(),
|
||||
|
|
|
@ -168,6 +168,7 @@ pub struct AppState {
|
|||
pub root_url_prefix: Value,
|
||||
pub public_url: String,
|
||||
pub site_title: Cow<'static, str>,
|
||||
pub site_subtitle: Option<Cow<'static, str>>,
|
||||
pub user_store: Arc<RwLock<HashMap<i64, User>>>,
|
||||
// ...
|
||||
}
|
||||
|
|
|
@ -114,7 +114,8 @@ pub async fn list(
|
|||
},
|
||||
];
|
||||
let context = minijinja::context! {
|
||||
title => state.site_title.as_ref(),
|
||||
site_title => state.site_title.as_ref(),
|
||||
site_subtitle => state.site_subtitle.as_ref(),
|
||||
page_title => &list.name,
|
||||
description => &list.description,
|
||||
post_policy => &post_policy,
|
||||
|
@ -123,7 +124,6 @@ pub async fn list(
|
|||
months => &months,
|
||||
hists => &hist,
|
||||
posts => posts_ctx,
|
||||
body => &list.description.clone().unwrap_or_default(),
|
||||
root_url_prefix => &state.root_url_prefix,
|
||||
list => Value::from_object(MailingList::from(list)),
|
||||
current_user => auth.current_user,
|
||||
|
@ -194,7 +194,8 @@ pub async fn list_post(
|
|||
},
|
||||
];
|
||||
let context = minijinja::context! {
|
||||
title => state.site_title.as_ref(),
|
||||
site_title => state.site_title.as_ref(),
|
||||
site_subtitle => state.site_subtitle.as_ref(),
|
||||
page_title => subject_ref,
|
||||
description => &list.description,
|
||||
list => Value::from_object(MailingList::from(list)),
|
||||
|
@ -295,7 +296,8 @@ pub async fn list_edit(
|
|||
},
|
||||
];
|
||||
let context = minijinja::context! {
|
||||
title => state.site_title.as_ref(),
|
||||
site_title => state.site_title.as_ref(),
|
||||
site_subtitle => state.site_subtitle.as_ref(),
|
||||
page_title => format!("Edit {} settings", list.name),
|
||||
description => &list.description,
|
||||
post_policy => &post_policy,
|
||||
|
|
|
@ -51,6 +51,7 @@ async fn main() {
|
|||
site_title: std::env::var("SITE_TITLE")
|
||||
.unwrap_or_else(|_| "mailing list archive".to_string())
|
||||
.into(),
|
||||
site_subtitle: std::env::var("SITE_SUBTITLE").ok().map(Into::into),
|
||||
user_store: Arc::new(RwLock::new(HashMap::default())),
|
||||
});
|
||||
|
||||
|
@ -176,9 +177,9 @@ async fn root(
|
|||
}];
|
||||
|
||||
let context = minijinja::context! {
|
||||
title => state.site_title.as_ref(),
|
||||
site_title => state.site_title.as_ref(),
|
||||
site_subtitle => state.site_subtitle.as_ref(),
|
||||
page_title => Option::<&'static str>::None,
|
||||
description => "",
|
||||
lists => &lists,
|
||||
root_url_prefix => &state.root_url_prefix,
|
||||
current_user => auth.current_user,
|
||||
|
|
|
@ -66,9 +66,9 @@ pub async fn settings(
|
|||
>>()?;
|
||||
|
||||
let context = minijinja::context! {
|
||||
title => state.site_title.as_ref(),
|
||||
site_title => state.site_title.as_ref(),
|
||||
site_subtitle => state.site_subtitle.as_ref(),
|
||||
page_title => "Account settings",
|
||||
description => "",
|
||||
root_url_prefix => &root_url_prefix,
|
||||
user => user,
|
||||
subscriptions => subscriptions,
|
||||
|
@ -307,9 +307,9 @@ pub async fn user_list_subscription(
|
|||
];
|
||||
|
||||
let context = minijinja::context! {
|
||||
title => state.site_title.as_ref(),
|
||||
site_title => state.site_title.as_ref(),
|
||||
site_subtitle => state.site_subtitle.as_ref(),
|
||||
page_title => "Subscription settings",
|
||||
description => "",
|
||||
root_url_prefix => &root_url_prefix,
|
||||
user => user,
|
||||
list => list,
|
||||
|
|
|
@ -378,6 +378,13 @@
|
|||
font-size: xx-large;
|
||||
}
|
||||
|
||||
main.layout>div.header>p.site-subtitle {
|
||||
margin: 1rem;
|
||||
margin-top: 0px;
|
||||
font-family: var(--grotesque-system-stack);
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
main.layout>div.header>div.page-header {
|
||||
width: 90vw;
|
||||
margin: 0px auto;
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
<body>
|
||||
<main class="layout">
|
||||
<div class="header">
|
||||
<h1>{{ title }}</h1>
|
||||
{% if description %}
|
||||
<p class="description">{{ description }}</p>
|
||||
<h1>{{ site_title }}</h1>
|
||||
{% if site_subtitle %}
|
||||
<p class="site-subtitle">{{ site_subtitle|safe }}</p>
|
||||
{% endif %}
|
||||
{% include "menu.html" %}
|
||||
<div class="page-header">
|
||||
|
|
Loading…
Reference in New Issue