-
Notifications
You must be signed in to change notification settings - Fork 67
[MERGED] support optional catch-all routes #15
Conversation
Next.js added a new, experimental, [optional catch-all routes](https://nextjs.org/docs/api-routes/dynamic-api-routes#optional-catch-all-api-routes), this adds support for it by looking for one more wrapping square bracket
Hey @rajington, This is excellent! Thank you so much for the PR and the contribution. 😊 This looks really good — let me take a closer look tonight and add a few tests. Hoping to merge and publish later today! 🙂 |
The default behavior of NextJS catch-all routes is to match only if at least one URL parameter is present. So far, next-on-netlify matched catch-all routes even when no URL parameter was present. For example, /pages/shows/[...slug] would match /shows/2, shows/3/my/path, but also /shows. This does not match the NextJS behavior described here: https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes This commit matches catch-all routes only when at least one URL parameter is present. It is in preparation for #15, which will introduce support for optional catch-all routes. Optional catch-all routes also match the page's base path without URL parameters (e.g. /shows).
Next.js added a new, experimental, [optional catch-all routes]( https://nextjs.org/docs/api-routes/dynamic-api-routes#optional-catch-all-api-routes ), this adds support for it. See: #15
Hi @rajington, Thanks again for this PR! I just added some tests and merged it (I rebased, so it's not showing up as merged 😐). It will go live with the next release of Two caveats:
Thank you again, @rajington! Let me know if you end up building something awesome with - Finn |
will do, thanks! you're doing a great job with this project! this might be the missing piece for SSR on Netlify, wouldn't be surprised if they featured it |
- Add support for [NextJS optional catch-all routes]( https://nextjs.org/docs/api-routes/dynamic-api-routes#optional-catch-all-api-routes ) ([#15](#15)) - Fix: An `index.js` page with `getStaticProps` no longer causes `next-on-netlify` to fail ([#18](#18)) - Fix: Catch-all routes now correctly require that at least one URL parameter is present (unlike optional catch-all routes) ([479b7e7](479b7e7)) - Fix: Data routes now correctly work for pages with catch-all routing ([0412b45](0412b45))
Thanks for the kind words, @rajington! It's a privilege to contribute back to the community and to meet nice people like yourself :) I just published |
they did already feature it! https://www.netlify.com/blog/2020/06/10/2-ways-to-create-server-rendered-routes-using-next.js-and-netlify/ |
Next.js added a new, experimental, optional catch-all routes, this adds support for it by looking for one more wrapping square bracket