Skip to content

Commit

Permalink
Move catch all routes example link into optional catch all routes sec…
Browse files Browse the repository at this point in the history
…tion, update broken next-site link
  • Loading branch information
blackwright committed Jul 18, 2020
1 parent 25488f4 commit 9f7f9fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/routing/dynamic-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]]`).
Expand All @@ -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:
Expand Down

0 comments on commit 9f7f9fc

Please sign in to comment.