Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: inform middleware usage along with metadata files (vercel#69136)
### What? When the user sets `robots.ts`, `sitemap.ts`, or other metadata files with `middleware.ts`, it may end in unexpected behavior if the middleware matcher is not set to ignore the corresponding paths. ### Why? The docs are missing the information for the users to "**configure middleware matcher if you have one along with generating metadata files to prevent route interference**". ### How? Updated the docs to add the matcher configuration as: ```ts export const config = { matcher: [ /* * Match all request paths except for the ones starting with: * - api (API routes) * - _next/static (static files) * - _next/image (image optimization files) * - favicon.ico, sitemap.xml, robots.txt (metadata files) <--- combined here */ '/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)', ], } ``` Added a "Good to Know" at the [entry of metadata API](https://nextjs.org/docs/app/api-reference/file-conventions/metadata) to configure the middleware matcher if used. Closes NDX-219
- Loading branch information