docs: fix redirect infrastructure modules (#12238)

* docs: fix redirect infrastructure modules

* change middleware
This commit is contained in:
Shahed Nasser
2025-04-18 14:19:55 +03:00
committed by GitHub
parent db0fe0fc91
commit 9167352778
6 changed files with 9 additions and 12 deletions
@@ -62,6 +62,7 @@ export async function GET(req: NextRequest, { params }: Params) {
headers: { headers: {
"Content-Type": "text/markdown", "Content-Type": "text/markdown",
}, },
status: 200,
}) })
} }
+1 -8
View File
@@ -3,18 +3,11 @@ import type { NextRequest } from "next/server"
export function middleware(request: NextRequest) { export function middleware(request: NextRequest) {
const path = request.nextUrl.pathname.replace("/index.html.md", "") 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( return NextResponse.rewrite(
new URL(`/md-content${path.replace("/index.html.md", "")}`, request.url) new URL(`/md-content${path.replace("/index.html.md", "")}`, request.url)
) )
} }
}
export const config = { export const config = {
matcher: "/:path*/index.html.md", matcher: "/((?!resources|api|ui|user-guide).*)index.html.md",
} }
@@ -74,6 +74,7 @@ export async function GET(req: NextRequest, { params }: Params) {
headers: { headers: {
"Content-Type": "text/markdown", "Content-Type": "text/markdown",
}, },
status: 200,
}) })
} }
+1 -1
View File
@@ -169,7 +169,7 @@ const nextConfig = {
permanent: true, permanent: true,
}, },
{ {
source: "/infrastructure-modules/:path*", source: "/architectural-modules/:path*",
destination: "/infrastructure-modules/:path*", destination: "/infrastructure-modules/:path*",
permanent: true, permanent: true,
}, },
@@ -43,6 +43,7 @@ export async function GET(req: NextRequest, { params }: Params) {
headers: { headers: {
"Content-Type": "text/markdown", "Content-Type": "text/markdown",
}, },
status: 200,
}) })
} }
@@ -63,6 +63,7 @@ export async function GET(req: NextRequest, { params }: Params) {
headers: { headers: {
"Content-Type": "text/markdown", "Content-Type": "text/markdown",
}, },
status: 200,
}) })
} }