Skip to content

Commit

Permalink
Disallow chatgpt and bard from reading my blog
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjunetime committed Jan 21, 2024
1 parent 2395979 commit 7ef1a38
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.route("/", get(home::get_home_view))
.route("/sitemap.xml", get(robots::get_sitemap_xml))
.route("/index.xml", get(robots::get_rss_xml))
.route("/robots.txt", get(robots::get_robots_txt))
.route("/page/:id", get(home::get_page_view))
.route("/post/:id", get(post::get_post_view))
.route("/font/:id", get(fonts::get_font))
Expand Down
10 changes: 10 additions & 0 deletions backend/src/robots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,13 @@ pub async fn get_rss_xml(mut tx: Tx<Postgres>) -> (StatusCode, String) {

(StatusCode::OK, RSS_XML.read().await.clone())
}

pub async fn get_robots_txt() -> &'static str {
"
User-agent: GPTBot
Disallow: /
User-agent: Google-Extended
Disallow: /
"
}

0 comments on commit 7ef1a38

Please sign in to comment.