Added robots.txt
This commit is contained in:
@@ -17,6 +17,7 @@ use pages::{
|
|||||||
index,
|
index,
|
||||||
projects::{project, projects},
|
projects::{project, projects},
|
||||||
};
|
};
|
||||||
|
use crate::pages::files::robots;
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(name = "aindustries-be", version, about = "This is the amazing webserver for aindustries.be!", long_about = None)]
|
#[command(name = "aindustries-be", version, about = "This is the amazing webserver for aindustries.be!", long_about = None)]
|
||||||
@@ -99,7 +100,7 @@ async fn main() {
|
|||||||
let assets = assets.replace("~", "/home/conta/Code/aindustries.be/assets");
|
let assets = assets.replace("~", "/home/conta/Code/aindustries.be/assets");
|
||||||
let data = web::Data::new(AppState { assets, pool });
|
let data = web::Data::new(AppState { assets, pool });
|
||||||
if let Ok(server) = HttpServer::new(move || {
|
if let Ok(server) = HttpServer::new(move || {
|
||||||
App::new().app_data(data.clone()).service(file).service(
|
App::new().app_data(data.clone()).service(file).service(robots).service(
|
||||||
web::scope("")
|
web::scope("")
|
||||||
.wrap(MimeType::new("text/html"))
|
.wrap(MimeType::new("text/html"))
|
||||||
.service(index)
|
.service(index)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ async fn file(file: Path<(String, String)>, data: web::Data<AppState>) -> impl R
|
|||||||
|
|
||||||
#[get("/robots.txt")]
|
#[get("/robots.txt")]
|
||||||
async fn robots() -> impl Responder {
|
async fn robots() -> impl Responder {
|
||||||
"User-agent: *\
|
"User-agent: *\n\
|
||||||
Disallow: /\
|
Disallow: /\n\
|
||||||
Allow: /$"
|
Allow: /$"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user