Skip to content

Commit 98ece77

Browse files
committed
introduces Vercel rewrites for production, to catch .md and .mdx paths
1 parent 02751ae commit 98ece77

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineMiddleware } from 'astro:middleware';
22

3-
// temporarily redirect .md and .mdx files, because `starlight-blog` doesn't support astro 5 fully yet
3+
// temporarily redirect .md and .mdx files, because `starlight-blog` doesn't support astro 5 fully yet (doesn't work on vercel. using vercel.json for vercel instead)
44
export const onRequest = defineMiddleware(async (context, next) => {
55
const url = new URL(context.request.url);
66
if (url.pathname.endsWith('.md') || url.pathname.endsWith('.mdx')) {

vercel.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"rewrites": [
3+
{
4+
"source": "/:path*(.md|.mdx)",
5+
"destination": "/:path*"
6+
}
7+
]
8+
}

0 commit comments

Comments
 (0)