mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
feat: Add option for a noindex meta tag on the HTML index page
Adds a new config option `index_page_allow_indexing` which defaults to false. Fixes: !1527
This commit is contained in:
@@ -18,11 +18,13 @@ async fn index_handler(
|
||||
struct Index<'a> {
|
||||
server_name: &'a str,
|
||||
first_run: bool,
|
||||
allow_indexing: bool,
|
||||
}
|
||||
|
||||
let template = Index {
|
||||
server_name: services.globals.server_name().as_str(),
|
||||
first_run: services.firstrun.is_first_run(),
|
||||
allow_indexing: services.config.index_page_allow_indexing,
|
||||
};
|
||||
Ok(Html(template.render()?))
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ struct PasswordResetQuery {
|
||||
struct PasswordReset<'a> {
|
||||
user_card: UserCard<'a>,
|
||||
body: PasswordResetBody,
|
||||
allow_indexing: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -74,6 +75,7 @@ async fn password_reset_form(
|
||||
let template = PasswordReset {
|
||||
user_card,
|
||||
body: PasswordResetBody::Form(reset_form),
|
||||
allow_indexing: services.config.index_page_allow_indexing,
|
||||
};
|
||||
|
||||
Ok(Html(template.render()?))
|
||||
@@ -112,6 +114,7 @@ async fn post_password_reset(
|
||||
let template = PasswordReset {
|
||||
user_card,
|
||||
body: PasswordResetBody::Success,
|
||||
allow_indexing: services.config.index_page_allow_indexing,
|
||||
};
|
||||
|
||||
Ok(Html(template.render()?).into_response())
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
<meta charset="UTF-8" />
|
||||
<title>{% block title %}Continuwuity{% endblock %}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
{%- if allow_indexing %}
|
||||
<meta name="robots" content="noindex" />
|
||||
{%- endif %}
|
||||
|
||||
<link rel="icon" href="/_continuwuity/resources/logo.svg">
|
||||
<link rel="stylesheet" href="/_continuwuity/resources/common.css">
|
||||
|
||||
Reference in New Issue
Block a user