Skip to content

Commit

Permalink
Update robots to allow crawling on non-prod
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Dec 2, 2024
1 parent c268c7e commit fdde46e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/robots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import type { MetadataRoute } from "next";

const robots = (): MetadataRoute.Robots => {
// Set the default rule
let rules: MetadataRoute.Robots["rules"] = { userAgent: "*" };
let rules: MetadataRoute.Robots["rules"];

// Allow or disallow indexing based on app environment
if (APP_ENV === AppEnv.PROD) {
rules = { ...rules, allow: "/" };
rules = { userAgent: "*", allow: "/" };
} else {
rules = { ...rules, disallow: "/" };
rules = [
{ userAgent: "*", disallow: "/" },
{ userAgent: "AhrefsSiteAudit", allow: "/" },
];
}

return {
Expand Down

0 comments on commit fdde46e

Please sign in to comment.