Skip to content

Commit

Permalink
fix(app-root): allow search engines in production
Browse files Browse the repository at this point in the history
- remove `/public/robots.txt`.
- add `/app/robots.js` which builds a dynamic `robots.txt` file, depending on `APP_ENV`. Allow access to `/` in production, but block the Zooniverse site otherwise.
  • Loading branch information
eatyourgreens committed Sep 27, 2024
1 parent 79c80fa commit e0afcd4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 0 additions & 2 deletions packages/app-root/public/robots.txt

This file was deleted.

19 changes: 19 additions & 0 deletions packages/app-root/src/app/robots.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const appEnv = process.env.APP_ENV || "development";

export default function robots() {
const isProduction = appEnv === "production";
if (!isProduction) {
return {
rules: {
userAgent: "*",
disallow: "/",
},
};
}
return {
rules: {
userAgent: "*",
allow: "/",
},
};
}

0 comments on commit e0afcd4

Please sign in to comment.