-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore _middleware routes #262
Ignore _middleware routes #262
Conversation
Introduced by next.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnsardine Once again, Thanks a lot for one more awesome PR!!
Can you please add test case which identifies middleware routes with url params. /projects/[id]/_middleware
It would make the regex bit more solid.!
…-sitemap into ignore-middleware-paths
I added the exact path you suggested. Before comitting I tested the following folder structure And interestingly the sitemap only ended up containing one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnsardine Yes, it already takes care of url params, that's why the /projects/[id]/_middleware
is being filtered out. I just suggested to add this test case to make it bit more solid :)
Thanks for adding the new test case and thanks for all your contributions so far. Approved!
Got it. You’re welcome. Thanks for the prompt review and merge |
Next.js 12 introduced Middlewares, this consists in
_middleware
files existing in the pages folder. Currently next-sitemap does not know it should ignore these files because they don't necessarily live at the root folder like other next.js files, so this change updates theisNextInternalUrl
to consider paths with_middleware
at the end of the path as internal urls.