From a8ba27052630baeba21058718fc53d8319ee5854 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Wed, 22 Jan 2020 01:09:06 -0500 Subject: [PATCH] Updated catch all docs --- docs/routing/dynamic-routes.md | 9 ++++++++- docs/routing/introduction.md | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/routing/dynamic-routes.md b/docs/routing/dynamic-routes.md index b69af21ae98f8..0be3069dacd12 100644 --- a/docs/routing/dynamic-routes.md +++ b/docs/routing/dynamic-routes.md @@ -58,9 +58,16 @@ Client-side navigations to a dynamic route can be handled with [`next/link`](/do ### Catch all routes +
+ Examples + +
+ Dynamic routes can be extended to catch all paths by adding three dots (`...`) inside the brackets. For example: -- `pages/post/[...slug]` matches `/post/a`, but also `post/a/b`, `post/a/b/c` and so on. +- `pages/post/[...slug].js` matches `/post/a`, but also `post/a/b`, `post/a/b/c` and so on. Matched parameters will be sent as a query parameter (`slug` in the example) to the page, and it will always be an array, so, the path `/post/a` will have the following `query` object: diff --git a/docs/routing/introduction.md b/docs/routing/introduction.md index 1b92f83378253..4191ff1d4ece9 100644 --- a/docs/routing/introduction.md +++ b/docs/routing/introduction.md @@ -30,7 +30,7 @@ To match a dynamic segment you can use the bracket syntax. This allows you to ma - `pages/blog/[slug].js` → `/blog/:slug` (`/blog/hello-world`) - `pages/[username]/settings.js` → `/:username/settings` (`/foo/settings`) -- `pages/post/[...all]` → `/post/*` (`/post/2020/id/title`) +- `pages/post/[...all].js` → `/post/*` (`/post/2020/id/title`) ## Linking between pages