Set proper site URL, preact devtools, sitemap, robots.txt

This commit is contained in:
2024-12-22 03:08:44 -06:00
parent 743ced86a8
commit a0417e0b19
3 changed files with 47 additions and 25 deletions

View File

@@ -1,13 +1,23 @@
// @ts-check
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import sitemap from '@astrojs/sitemap';
import preact from '@astrojs/preact';
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import sitemap from "@astrojs/sitemap";
import preact from "@astrojs/preact";
// https://astro.build/config
export default defineConfig({
integrations: [tailwind(), sitemap(), preact()]
site: process.env.DEV
? "https://localhost:4321"
: `https://${process.env.RAILWAY_PUBLIC_DOMAIN}`,
integrations: [
tailwind(),
sitemap({
changefreq: "monthly",
priority: 1.0,
// xslURL: "/sitemap.xsl",
}),
preact({
devtools: process.env.DEV != undefined ? true : false,
}),
],
});

View File

@@ -1,22 +1,21 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="generator" content={Astro.generator} />
<title>Astro Basics</title>
</head>
<body>
<slot />
</body>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<title>Dynamic Preauth</title>
</head>
<body>
<slot />
</body>
</html>
<style>
html,
body {
margin: 0;
width: 100%;
height: 100%;
}
html,
body {
margin: 0;
width: 100%;
height: 100%;
}
</style>

View File

@@ -0,0 +1,13 @@
import type { APIRoute } from "astro";
const getRobotsTxt = (sitemapURL: URL) => `
User-agent: *
Disallow: /download/
Sitemap: ${sitemapURL.href}
`;
export const GET: APIRoute = ({ site }) => {
const sitemapURL = new URL("sitemap-index.xml", site);
return new Response(getRobotsTxt(sitemapURL));
};