Skip to content

Commit b6474e1

Browse files
committed
docs: improve comment in the middleware for sitemap.xml and robots.txt
1 parent 3688b8a commit b6474e1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/middleware.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ export default function middleware(
4343
})(request, event);
4444
}
4545

46-
// get the path for the current request
46+
// Extract the URL pathname
4747
const path = request.nextUrl.pathname;
4848

49-
// ? check some files name for serve, what ever you want
49+
// Allow direct access to sitemap.xml and robots.txt without i18n middleware processing
50+
// This ensures these files are properly served for SEO purposes
51+
// Related to GitHub issue: https://github.com/ixartz/Next-js-Boilerplate/issues/356
5052
if (path === '/sitemap.xml' || path === '/robots.txt') {
5153
return NextResponse.next();
5254
}

0 commit comments

Comments
 (0)