route.ts 490 B

1234567891011121314151617181920212223242526
  1. import { NextResponse } from 'next/server'
  2. export async function GET() {
  3. const robots = `User-agent: *
  4. Allow: /
  5. # 禁止爬取API路由
  6. Disallow: /api/
  7. # 禁止爬取私有文件
  8. Disallow: /_next/
  9. Disallow: /admin/
  10. # Sitemap位置
  11. Sitemap: https://aiartools.com/sitemap.xml
  12. # 抓取延迟(可选)
  13. Crawl-delay: 1`
  14. return new NextResponse(robots, {
  15. headers: {
  16. 'Content-Type': 'text/plain',
  17. 'Cache-Control': 'public, max-age=86400, s-maxage=86400',
  18. },
  19. })
  20. }