feat: sitemap

This commit is contained in:
TrèsAbhi committed 2024-10-14 10:52:40 -05:00
1 parent dfc55b745b
commit 5a5643ce3d
5 files changed
+17 -12

No files matched your search

BIN
View File
Binary file not shown.
+3 -1
View File
@@ -1,6 +1,7 @@
// @ts-check
import react from '@astrojs/react';
import sitemap from '@astrojs/sitemap';
import vercel from '@astrojs/vercel/serverless';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import { defineConfig } from 'astro/config';
@@ -9,8 +10,9 @@ export default defineConfig({
devToolbar: { enabled: false },
output: 'hybrid',
adapter: vercel(),
site: 'https://blitzkit.app',
integrations: [react()],
integrations: [react(), sitemap()],
vite: {
plugins: [vanillaExtractPlugin()],
resolve: {
+1
View File
@@ -34,6 +34,7 @@
"devDependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/react": "^3.6.2",
"@astrojs/sitemap": "^3.2.0",
"@astrojs/vercel": "^7.8.1",
"@types/js-cookie": "^3.0.6",
"@types/react": "^18.3.5",
@@ -41,6 +41,7 @@ const isRoot = pathname === '/';
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="sitemap" href="/sitemap-index.xml" />
<Party3 />
</head>
+12 -11
View File
@@ -3,18 +3,19 @@ import type { APIContext } from 'astro';
export async function GET({}: APIContext) {
const allowRobots = assertSecret(import.meta.env.ALLOW_ROBOTS) === 'true';
const site = assertSecret(import.meta.env.SITE);
return new Response(`
User-agent: *
${allowRobots ? 'Allow' : 'Disallow'}: /
User-agent: *
${allowRobots ? 'Allow' : 'Disallow'}: /
${
allowRobots
? `
Host: https://blitzkit.app
Sitemap: https://blitzkit.app/sitemap.txt
`
: ''
}
`);
${
allowRobots
? `
Host: ${site}
Sitemap: ${site}/sitemap-index.xml
`
: ''
}
`);
}