import type { MetadataRoute } from 'next'; import { COMING_SOON } from './config'; // Served as /robots.txt by Next's file convention. // // While the launch gate is up we tell crawlers to skip the whole site — // the only thing that would index is the "Opening soon" holding page, and // having that be Google's first impression of lumengesso.com (cached for // weeks) would be worse than no impression. Once COMING_SOON=false we // open it up and point at the sitemap. // // Admin + checkout + auth routes are always disallowed regardless of // launch state; they're either gated or transient and shouldn't appear // in search results. const AI_CRAWLERS = [ 'GPTBot', 'OAI-SearchBot', 'ChatGPT-User', 'ClaudeBot', 'Claude-User', 'Claude-SearchBot', 'PerplexityBot', 'Perplexity-User', 'Google-Extended', 'Applebot-Extended', 'CCBot', ]; export default function robots(): MetadataRoute.Robots { const SITE = (process.env.NEXT_PUBLIC_SITE_URL || 'https://lumengesso.com').replace(/\/$/, ''); if (COMING_SOON) { return { rules: [{ userAgent: '*', disallow: '/' }], // Still expose the sitemap (just the home page in coming-soon mode) // so we have something to feed Search Console once we flip the gate. sitemap: `${SITE}/sitemap.xml`, }; } const disallow = [ '/admin', '/admin/', '/api/', '/auth/', '/checkout', '/login', '/orders', '/orders/', ]; return { rules: [ { userAgent: '*', allow: '/', disallow }, // AI search and assistant crawlers, named so they know they're // welcome: being cited in ChatGPT, Claude, Perplexity, Gemini and // Apple answers is how people find the studio there. Same rules. { userAgent: AI_CRAWLERS, allow: '/', disallow }, ], sitemap: `${SITE}/sitemap.xml`, host: SITE, }; }