diff --git a/astro.config.mjs b/astro.config.mjs index a50ea08..f330868 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -166,9 +166,5 @@ export default defineConfig({ }), docsMarkdownIntegration(), ], - // Deploy Astro middleware as a Vercel Edge Function so it runs at - // request time for ALL pages, including pre-rendered static pages. - // Without this, middleware only runs at build time for static pages - // and content negotiation (Accept: text/markdown) doesn't work. - adapter: vercel({ middlewareMode: 'edge' }), + adapter: vercel(), }); diff --git a/vercel.json b/vercel.json index 6d747ef..1d5ad06 100644 --- a/vercel.json +++ b/vercel.json @@ -70,6 +70,18 @@ ] } ], + "rewrites": [ + { + "source": "/", + "has": [{ "type": "header", "key": "accept", "value": ".*text/markdown.*" }], + "destination": "/index.md" + }, + { + "source": "/:path+", + "has": [{ "type": "header", "key": "accept", "value": ".*text/markdown.*" }], + "destination": "/:path+.md" + } + ], "redirects": [ { "source": "/advanced/command-line-flags",