Skip to content

Commit

Permalink
Updated catch all docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lfades committed Jan 22, 2020
1 parent cd24385 commit a8ba270
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion docs/routing/dynamic-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,16 @@ Client-side navigations to a dynamic route can be handled with [`next/link`](/do

### Catch all routes

<details>
<summary><b>Examples</b></summary>
<ul>
<li><a href="https://github.com/zeit/next.js/tree/canary/examples/catch-all-routes">Catch All Routes</a></li>
</ul>
</details>

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:

Expand Down
2 changes: 1 addition & 1 deletion docs/routing/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a8ba270

Please sign in to comment.