25 lines
619 B
TypeScript
25 lines
619 B
TypeScript
import type { MetadataRoute } from "next";
|
|
|
|
const isProduction =
|
|
process.env.NEXT_PUBLIC_APP_URL?.includes("trptk.com") &&
|
|
!process.env.NEXT_PUBLIC_APP_URL?.includes("staging");
|
|
|
|
export default function robots(): MetadataRoute.Robots {
|
|
// Block all crawlers on non-production environments (e.g. staging.trptk.com)
|
|
if (!isProduction) {
|
|
return {
|
|
rules: [{ userAgent: "*", disallow: "/" }],
|
|
};
|
|
}
|
|
|
|
return {
|
|
rules: [
|
|
{
|
|
userAgent: "*",
|
|
allow: "/",
|
|
disallow: ["/account/", "/checkout/", "/api/"],
|
|
},
|
|
],
|
|
sitemap: "https://trptk.com/sitemap.xml",
|
|
};
|
|
}
|