23 lines
524 B
TypeScript
23 lines
524 B
TypeScript
import { NextResponse } from 'next/server';
|
|
|
|
export async function GET() {
|
|
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || 'https://your-domain.com';
|
|
|
|
const robotsTxt = `User-agent: *
|
|
Allow: /
|
|
Disallow: /api/
|
|
Disallow: /admin/
|
|
Disallow: /_next/
|
|
|
|
Sitemap: ${baseUrl}/sitemap.xml
|
|
Host: ${baseUrl}`;
|
|
|
|
return new NextResponse(robotsTxt, {
|
|
status: 200,
|
|
headers: {
|
|
'Content-Type': 'text/plain',
|
|
'Cache-Control': 'public, max-age=86400, s-maxage=86400',
|
|
},
|
|
});
|
|
}
|