From 9f7f9fc09271c7d34c5437f45b664a9aad6e7397 Mon Sep 17 00:00:00 2001 From: Jerry Gao Date: Sat, 18 Jul 2020 14:21:56 -0400 Subject: [PATCH] Move catch all routes example link into optional catch all routes section, update broken next-site link --- 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: