troylusty.com/src/pages/robots.txt.ts
Troy aa26e7cd55
All checks were successful
Docker / run-tests (push) Successful in 2m40s
Docker / build-and-push-image (push) Successful in 2m38s
feat: article tags link to articles with the same tag
2025-03-11 20:56:54 +00:00

16 lines
342 B
TypeScript

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