Skip to content

Commit 02b5c23

Browse files
committed
Disable middleware
1 parent 3dc6ab5 commit 02b5c23

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/middleware.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import type { MiddlewareHandler } from 'astro';
1+
// import type { MiddlewareHandler } from 'astro';
22

3-
/**
4-
* This middleware converts the pathname to lowercase and removes any trailing slashes for documentation pages and redirects the request to the normalized URL with a 301 status code.
5-
*/
6-
export const onRequest: MiddlewareHandler = async ({ request }, next) => {
7-
const url = new URL(request.url);
3+
// /**
4+
// * This middleware converts the pathname to lowercase and removes any trailing slashes for documentation pages and redirects the request to the normalized URL with a 301 status code.
5+
// */
6+
// export const onRequest: MiddlewareHandler = async ({ request }, next) => {
7+
// const url = new URL(request.url);
88

9-
if (url.pathname.includes('/wiki')) {
10-
const normalizedPath = url.pathname.toLowerCase().replace(/\/$/, '');
9+
// if (url.pathname.includes('/wiki')) {
10+
// const normalizedPath = url.pathname.toLowerCase().replace(/\/$/, '');
1111

12-
if (url.pathname !== normalizedPath) {
13-
const redirectUrl = `${normalizedPath}${url.search}`;
14-
return new Response(null, {
15-
status: 301,
16-
headers: {
17-
Location: redirectUrl,
18-
},
19-
});
20-
}
21-
}
12+
// if (url.pathname !== normalizedPath) {
13+
// const redirectUrl = `${normalizedPath}${url.search}`;
14+
// return new Response(null, {
15+
// status: 301,
16+
// headers: {
17+
// Location: redirectUrl,
18+
// },
19+
// });
20+
// }
21+
// }
2222

23-
return next();
24-
};
23+
// return next();
24+
// };

0 commit comments

Comments
 (0)