Skip to content

Commit

Permalink
add robots.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub committed Jun 27, 2023
1 parent 7a2896a commit 3a5051f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/app_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
mod_inn_post, post, post_delete, post_downvote, post_hide, post_lock, post_upvote,
preview, tag,
},
meta_handler::{handler_404, home, style},
meta_handler::{handler_404, home, robots, style},
notification::notification,
solo::{solo, solo_delete, solo_like, solo_list, solo_post},
tantivy::search,
Expand Down Expand Up @@ -108,6 +108,7 @@ pub async fn router() -> Router {

let mut router_static = Router::new()
.route("/static/style.css", get(style))
.route("/robots.txt", get(robots))
.nest_service("/static/avatars", ServeDir::new(&CONFIG.avatars_path))
.nest_service("/static/inn_icons", ServeDir::new(&CONFIG.inn_icons_path))
.nest_service("/static/upload", ServeDir::new(&CONFIG.upload_path));
Expand Down
4 changes: 4 additions & 0 deletions src/controller/meta_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ pub(crate) async fn style() -> (HeaderMap, &'static str) {
(headers, &CSS)
}

pub(crate) async fn robots() -> &'static str {
"User-agent: *\nDisallow: /search"
}

pub async fn shutdown_signal() {
let ctrl_c = async {
signal::ctrl_c()
Expand Down

0 comments on commit 3a5051f

Please sign in to comment.