import type { MetadataRoute } from 'next'; import { getCanonicalSiteUrl } from '@/core/lib/site-url'; /** * robots.txt with an explicit AI-crawler policy. * * Merchants WANT to be recommended by AI assistants, so the bots that power * AI search/answers are allowed by name — an explicit allow survives any * future tightening of the `*` rule and documents intent to auditors: * * - OAI-SearchBot / ChatGPT-User → ChatGPT search + shopping visibility * - Claude-SearchBot / Claude-User → Claude search + user-requested reads * - PerplexityBot / Perplexity-User → Perplexity shopping visibility * - Bingbot → also feeds Microsoft Copilot answers * - Applebot → Siri / Apple search surfaces * - Amazonbot → Alexa / Amazon shopping surfaces * * TRAINING bots (GPTBot, ClaudeBot, CCBot, Google-Extended, Meta- * ExternalAgent, Applebot-Extended) are also allowed by default: model-weight * familiarity with the store feeds zero-shot recommendations, which is what a * store wants. A merchant who objects to AI training on their content can * move those user-agents to a `disallow: '/'` rule — that does NOT affect * search visibility (Google-Extended, for example, has no effect on Google * Search or AI Overviews; it only gates Gemini training). * * Checkout/account/API paths stay disallowed for every agent. */ const DISALLOWED_PATHS = ['/api/', '/auth/', '/checkout/', '/account/']; const AI_SEARCH_BOTS = [ 'OAI-SearchBot', 'ChatGPT-User', 'Claude-SearchBot', 'Claude-User', 'PerplexityBot', 'Perplexity-User', 'Bingbot', 'Applebot', 'Amazonbot', ]; const AI_TRAINING_BOTS = [ 'GPTBot', 'ClaudeBot', 'CCBot', 'Google-Extended', 'Meta-ExternalAgent', 'Applebot-Extended', ]; export default async function robots(): Promise { const baseUrl = await getCanonicalSiteUrl(); return { rules: [ { userAgent: '*', allow: '/', disallow: DISALLOWED_PATHS, }, { userAgent: AI_SEARCH_BOTS, allow: '/', disallow: DISALLOWED_PATHS, }, { userAgent: AI_TRAINING_BOTS, allow: '/', disallow: DISALLOWED_PATHS, }, ], sitemap: `${baseUrl}/sitemap.xml`, }; }