docs: fix some index.html.md links resulting 404 (#11379)
This commit is contained in:
1 parent
3f6425bada
commit
1e7c072efa
4 files changed
+10761
-10754
No files matched your search
@@ -2,12 +2,17 @@ import { NextResponse } from "next/server"
|
||||
import type { NextRequest } from "next/server"
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
return NextResponse.rewrite(
|
||||
new URL(
|
||||
`/md-content${request.nextUrl.pathname.replace("/index.html.md", "")}`,
|
||||
request.url
|
||||
const path = request.nextUrl.pathname.replace("/index.html.md", "")
|
||||
if (
|
||||
!path.startsWith("/resources") &&
|
||||
!path.startsWith("/ui") &&
|
||||
!path.startsWith("/api") &&
|
||||
!path.startsWith("/user-guide")
|
||||
) {
|
||||
return NextResponse.rewrite(
|
||||
new URL(`/md-content${path.replace("/index.html.md", "")}`, request.url)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export const config = {
|
||||
|
||||
Reference in new issue
Block a user