diff --git a/frontend/astro.config.mjs b/frontend/astro.config.mjs index 9fd5a01..d433561 100644 --- a/frontend/astro.config.mjs +++ b/frontend/astro.config.mjs @@ -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()] -}); \ No newline at end of file + 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, + }), + ], +}); diff --git a/frontend/src/layouts/Base.astro b/frontend/src/layouts/Base.astro index e455c61..cc718d6 100644 --- a/frontend/src/layouts/Base.astro +++ b/frontend/src/layouts/Base.astro @@ -1,22 +1,21 @@ - - - - - - Astro Basics - - - - + + + + + Dynamic Preauth + + + + diff --git a/frontend/src/pages/robots.txt.ts b/frontend/src/pages/robots.txt.ts new file mode 100644 index 0000000..dfd4840 --- /dev/null +++ b/frontend/src/pages/robots.txt.ts @@ -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)); +};