Skip to content

Commit e8136c6

Browse files
committed
refactor: update robots.txt to disallow bots on env that's not production
1 parent 40ff1fa commit e8136c6

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

next-sitemap.config.mjs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ import { env } from "node:process";
22
import { URL } from "node:url";
33

44
const SITE_URL = env.NEXT_PUBLIC_SITE_URL;
5+
const HP_ENV_NAME = env.HEADLESS_METADATA_ENV_NAME;
6+
7+
const policy =
8+
HP_ENV_NAME === "faust-prod"
9+
? {
10+
userAgent: "*",
11+
allow: "/",
12+
}
13+
: {
14+
userAgent: "*",
15+
disallow: "/",
16+
};
517

618
export default {
719
siteUrl: SITE_URL,
@@ -12,11 +24,6 @@ export default {
1224
additionalSitemaps: [
1325
new URL("/wp-sitemap.xml", SITE_URL), // <==== Add here
1426
],
15-
policies: [
16-
{
17-
userAgent: "*",
18-
allow: "/",
19-
},
20-
],
27+
policies: [policy],
2128
},
2229
};

0 commit comments

Comments
 (0)