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