troylusty.com/src/pages/robots.txt.ts

17 lines
342 B
TypeScript
Raw Normal View History

2024-12-23 21:18:55 +00:00
import type { APIRoute } from "astro";
const getRobotsTxt = (sitemapURL: URL) => `
User-agent: *
Disallow: /cv
Disallow: /tags
Disallow: /tags/*
2024-12-23 21:18:55 +00:00
Allow: /
Sitemap: ${sitemapURL.href}
`;
export const GET: APIRoute = ({ site }) => {
const sitemapURL = new URL("sitemap-index.xml", site);
return new Response(getRobotsTxt(sitemapURL));
};