Skip to content

Commit

Permalink
feat(preview): add robots route
Browse files Browse the repository at this point in the history
  • Loading branch information
SannyNguyenHung committed Jan 5, 2024
1 parent d54f710 commit 4694f96
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
24 changes: 24 additions & 0 deletions app/routes/robots[.]txt.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { LoaderFunctionArgs } from "@remix-run/node";
import { config } from "~/services/env/env.server";

export const loader = () => {
// Initial robot content is to disallow all
let robotContent = `
User-agent: *
Disallow: /
`;

if (config().ENVIRONMENT === "production") {
robotContent = `
User-agent: *
Disallow: /storybook
`;
}

return new Response(robotContent, {
status: 200,
headers: {
"Content-Type": "text/plain",
},
});
};
2 changes: 0 additions & 2 deletions public/robots.txt

This file was deleted.

0 comments on commit 4694f96

Please sign in to comment.