Add robots.txt #9
This commit is contained in:
parent
6f3beb6368
commit
81a50a237d
1 changed files with 8 additions and 4 deletions
|
@ -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")]
|
||||||
|
|
Loading…
Reference in a new issue