All checks were successful
Deploy to SFTP Server / build (push) Successful in 4m0s
14 lines
294 B
TypeScript
14 lines
294 B
TypeScript
import type { APIRoute } from 'astro';
|
|
|
|
const getRobotsTxt = (sitemapURL: URL) => `
|
|
User-agent: *
|
|
Allow: /
|
|
|
|
Sitemap: ${sitemapURL.href}
|
|
`;
|
|
|
|
export const GET: APIRoute = ({ site }) => {
|
|
const sitemapURL = new URL('sitemap-index.xml', site);
|
|
return new Response(getRobotsTxt(sitemapURL));
|
|
};
|