|
1 | 1 | // @ts-check |
2 | 2 | import mdx from "@astrojs/mdx"; |
| 3 | +import node from "@astrojs/node"; |
3 | 4 | import sitemap from "@astrojs/sitemap"; |
4 | 5 | import tailwindcss from "@tailwindcss/vite"; |
5 | 6 | import { defineConfig } from "astro/config"; |
@@ -30,16 +31,30 @@ if (isProductionDeploy && site.includes("example.com")) { |
30 | 31 | export default defineConfig({ |
31 | 32 | site, |
32 | 33 |
|
| 34 | + // The site is static EXCEPT one page: `/contact/` sets `export const prerender = false` because |
| 35 | + // it receives the Resend form POST and re-renders itself with the result (the grafio pattern). |
| 36 | + // That single on-demand route is the only thing this Node server ever runs; every other route |
| 37 | + // still prerenders to HTML. `mode: "standalone"` emits a self-contained Node server (dist/server + |
| 38 | + // dist/client) that fits the Dokploy/Traefik/Docker setup this project deploys behind — swap it for |
| 39 | + // `@astrojs/netlify` / `@astrojs/vercel` in two lines if the host changes (nothing else knows which |
| 40 | + // adapter is mounted). Drop the contact form and remove this line to go fully static again. |
| 41 | + adapter: node({ mode: "standalone" }), |
| 42 | + |
33 | 43 | // One canonical URL shape: the directory build emits trailing slashes, and canonical + OG agree |
34 | 44 | // on that shape (see .claude/rules/seo.md). |
35 | 45 | trailingSlash: "always", |
36 | 46 |
|
37 | 47 | // mdx() renders .mdx content. |
38 | 48 | // sitemap filter: never list noindex pages — the dev-only /examples catalog and 404s |
39 | 49 | // both set `noindex` in the markup, so a sitemap entry for them would contradict it. |
| 50 | + // customPages: the sitemap can't enumerate the on-demand `/contact/` route (it emits no static |
| 51 | + // file), so it's added by hand — the one manual entry seo.md prescribes for SSR routes. |
40 | 52 | integrations: [ |
41 | 53 | mdx(), |
42 | | - sitemap({ filter: (page) => !page.includes("/examples/") && !page.includes("/404/") }), |
| 54 | + sitemap({ |
| 55 | + filter: (page) => !page.includes("/examples/") && !page.includes("/404/"), |
| 56 | + customPages: [new URL("/contact/", site).href], |
| 57 | + }), |
43 | 58 | ], |
44 | 59 |
|
45 | 60 | vite: { |
|
0 commit comments