From 4a136476e75a9f6e40f3fa59abd65a6735f9389b Mon Sep 17 00:00:00 2001 From: Jerry Gao Date: Sat, 18 Jul 2020 15:54:40 -0400 Subject: [PATCH] Fix broken example link in docs for catch all routes (#15295) Fixes a broken link on https://nextjs.org/docs/routing/dynamic-routes This path was updated from `pages/docs/[...slug].js` to `pages/docs/[[...slug]].js`, so I've updated the link and moved that example down to the "Optional catch all routes" section. --- docs/routing/dynamic-routes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/routing/dynamic-routes.md b/docs/routing/dynamic-routes.md index 71a877f0c9f3e..5b479d16e8fce 100644 --- a/docs/routing/dynamic-routes.md +++ b/docs/routing/dynamic-routes.md @@ -83,8 +83,6 @@ And in the case of `/post/a/b`, and any other matching path, new parameters will { "slug": ["a", "b"] } ``` -> A good example of catch all routes is the Next.js docs, a single page called [pages/docs/[...slug].js](https://github.com/zeit/next-site/blob/master/pages/docs/%5B...slug%5D.js) takes care of all the docs you're currently looking at. - ### Optional catch all routes Catch all routes can be made optional by including the parameter in double brackets (`[[...slug]]`). @@ -99,6 +97,8 @@ The `query` objects are as follows: { "slug": ["a", "b"] } // `GET /post/a/b` (multi-element array) ``` +> A good example of optional catch all routes is the Next.js docs, a single page called [pages/docs/[[...slug]].js](https://github.com/zeit/next-site/blob/master/pages/docs/%5B%5B...slug%5D%5D.js) takes care of all the docs you're currently looking at. + ## Caveats - Predefined routes take precedence over dynamic routes, and dynamic routes over catch all routes. Take a look at the following examples: