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 // @ts-check
import { defineConfig } from 'astro/config'; import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import tailwind from '@astrojs/tailwind'; import sitemap from "@astrojs/sitemap";
import preact from "@astrojs/preact";
import sitemap from '@astrojs/sitemap';
import preact from '@astrojs/preact';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ 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> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="generator" content={Astro.generator} /> <title>Dynamic Preauth</title>
<title>Astro Basics</title> </head>
</head> <body>
<body> <slot />
<slot /> </body>
</body>
</html> </html>
<style> <style>
html, html,
body { body {
margin: 0; margin: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </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));
};