From 1dde7c15b112fd34c890f85a1cd8f9845e57a4a0 Mon Sep 17 00:00:00 2001 From: Kevin F Date: Fri, 20 Sep 2024 13:55:01 +0200 Subject: [PATCH] fixed site --- src/pages/robots.txt.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/robots.txt.ts b/src/pages/robots.txt.ts index 196eea9..d358c74 100644 --- a/src/pages/robots.txt.ts +++ b/src/pages/robots.txt.ts @@ -4,10 +4,15 @@ const getRobotsTxt = (sitemapURL: URL) => ` User-agent: * Allow: / -Sitemap: ${sitemapURL.href + sitemapURL.pathname} +Sitemap: ${sitemapURL.href} `; export const GET: APIRoute = ({ site }) => { + console.log(site); + if (!site) { + return new Response('No site object found', { status: 500 }); + } + site.pathname = import.meta.env.BASE_URL; const sitemapURL = new URL('sitemap-index.xml', site); return new Response(getRobotsTxt(sitemapURL)); }; \ No newline at end of file