Add robots.txt #9

This commit is contained in:
Mylloon 2023-02-09 12:01:35 +01:00
parent 6f3beb6368
commit 81a50a237d
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -19,7 +19,7 @@ struct SecurityTemplate {
url: String, url: String,
} }
fn get_security(config: Config, addr: Option<SocketAddr>) -> std::string::String { fn get_security(config: Config, addr: Option<SocketAddr>) -> String {
let data = SecurityTemplate { let data = SecurityTemplate {
contact: config.mail.unwrap_or_default(), contact: config.mail.unwrap_or_default(),
pref_lang: config.lang.unwrap_or_default(), pref_lang: config.lang.unwrap_or_default(),
@ -31,14 +31,18 @@ fn get_security(config: Config, addr: Option<SocketAddr>) -> std::string::String
#[get("/humans.txt")] #[get("/humans.txt")]
pub async fn humans() -> impl Responder { pub async fn humans() -> impl Responder {
// TODO // TODO, see https://humanstxt.org/humans.txt
actix_web::web::Redirect::to("/") actix_web::web::Redirect::to("/")
} }
#[get("/robots.txt")] #[get("/robots.txt")]
pub async fn robots() -> impl Responder { pub async fn robots() -> impl Responder {
// TODO HttpResponse::Ok().body(get_robots())
actix_web::web::Redirect::to("/") }
fn get_robots() -> String {
// TODO, see https://www.robotstxt.org/orig.html
"User-agent: * Allow: /".to_string()
} }
#[get("/sitemap.xml")] #[get("/sitemap.xml")]