Add sitemap and robots
This commit is contained in:
@@ -33,6 +33,7 @@ const headDescription: string = description || site.description;
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<link rel="apple-touch-icon" href="/favicon.png" />
|
||||
|
||||
<link rel="sitemap" href="/sitemap-index.xml" />
|
||||
<SEO title={headTitle} description={headDescription} {image} />
|
||||
|
||||
<ThemeManager defaultTheme="auto" />
|
||||
|
13
src/pages/robots.txt.ts
Normal file
13
src/pages/robots.txt.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
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));
|
||||
};
|
Reference in New Issue
Block a user