diff --git a/src/main.rs b/src/main.rs index 9dd6f1a..a57e640 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,7 @@ use pages::{ index, projects::{project, projects}, }; +use crate::pages::files::robots; #[derive(Parser)] #[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 data = web::Data::new(AppState { assets, pool }); 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("") .wrap(MimeType::new("text/html")) .service(index) diff --git a/src/pages/files.rs b/src/pages/files.rs index e8d4d35..81f60b3 100644 --- a/src/pages/files.rs +++ b/src/pages/files.rs @@ -20,7 +20,7 @@ async fn file(file: Path<(String, String)>, data: web::Data) -> impl R #[get("/robots.txt")] async fn robots() -> impl Responder { - "User-agent: *\ - Disallow: /\ + "User-agent: *\n\ + Disallow: /\n\ Allow: /$" }