fix: apply seo agent improvements to src/app/robots.ts

This commit is contained in:
cupadev-admin 2026-03-09 19:01:19 +00:00
parent 4909d40743
commit b70ae434a3
1 changed files with 32 additions and 0 deletions

32
src/app/robots.ts Normal file
View File

@ -0,0 +1,32 @@
import type { MetadataRoute } from 'next'
const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL || 'https://example.com'
export default function robots(): MetadataRoute.Robots {
return {
rules: [
{
userAgent: '*',
allow: '/',
disallow: [
'/admin/',
'/admin',
'/api/',
],
},
{
// Block AI training crawlers
userAgent: [
'GPTBot',
'ChatGPT-User',
'CCBot',
'anthropic-ai',
'Claude-Web',
],
disallow: '/',
},
],
sitemap: `${SITE_URL}/sitemap.xml`,
host: SITE_URL,
}
}