Some checks failed
Test and deploy staging / staging (push) Has been cancelled
16 lines
482 B
TypeScript
16 lines
482 B
TypeScript
import { SITE_ORIGIN } from '$lib/seo';
|
|
import type { RequestHandler } from './$types';
|
|
|
|
export const GET: RequestHandler = ({ url }) => {
|
|
const production = url.hostname === new URL(SITE_ORIGIN).hostname;
|
|
const body = production
|
|
? `User-agent: *\nAllow: /\nSitemap: ${SITE_ORIGIN}/sitemap.xml\n`
|
|
: 'User-agent: *\nDisallow: /\n';
|
|
return new Response(body, {
|
|
headers: {
|
|
'content-type': 'text/plain; charset=utf-8',
|
|
'cache-control': 'public, max-age=3600'
|
|
}
|
|
});
|
|
};
|