Added robots.txt
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -20,7 +20,7 @@ async fn file(file: Path<(String, String)>, data: web::Data<AppState>) -> impl R
|
||||
|
||||
#[get("/robots.txt")]
|
||||
async fn robots() -> impl Responder {
|
||||
"User-agent: *\
|
||||
Disallow: /\
|
||||
"User-agent: *\n\
|
||||
Disallow: /\n\
|
||||
Allow: /$"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user