Skip to content

Commit

Permalink
fixed site
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Sep 20, 2024
1 parent e437e3f commit 1dde7c1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pages/robots.txt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
};

0 comments on commit 1dde7c1

Please sign in to comment.