Add sitemap.xml, robots.txt

This commit is contained in:
SkyfallWasTaken 2024-07-14 13:40:05 +01:00
parent e94666e44e
commit 8cdaa9e69a
6 changed files with 25 additions and 4 deletions

View file

@ -7,6 +7,7 @@ import svelte from "@astrojs/svelte";
// https://astro.build/config
export default defineConfig({
// FIXME: don't hardcode this
site: "https://skyfall.dev",
integrations: [mdx(), sitemap(), tailwind(), svelte()],
/* output: "hybrid", // or 'server'

BIN
bun.lockb

Binary file not shown.

View file

@ -51,5 +51,8 @@ const { title, description, image = "/blog-placeholder-1.jpg" } = Astro.props;
<meta property="twitter:description" content={description} />
<meta property="twitter:image" content={new URL(image, Astro.url)} />
<!-- Sitemap -->
<link rel="sitemap" href="/sitemap-index.xml" />
<!-- Transitions -->
<ViewTransitions/>
<ViewTransitions />

16
src/pages/robots.txt.ts Normal file
View file

@ -0,0 +1,16 @@
import type { APIRoute } from "astro";
const robotsTxt = `
User-agent: *
Allow: /
Sitemap: ${new URL("sitemap-index.xml", import.meta.env.SITE).href}
`.trim();
export const GET: APIRoute = () => {
return new Response(robotsTxt, {
headers: {
"Content-Type": "text/plain; charset=utf-8",
},
});
};

View file

@ -1,5 +1,5 @@
import { vitePreprocess } from '@astrojs/svelte';
import { vitePreprocess } from "@astrojs/svelte";
export default {
preprocess: vitePreprocess(),
}
preprocess: vitePreprocess(),
};

View file

@ -1,5 +1,6 @@
{
"extends": "astro/tsconfigs/strict",
"exclude": ["dist/**"],
"compilerOptions": {
"strictNullChecks": true
}