Skip to content

Commit

Permalink
Fix broken example link in docs for catch all routes (#15295)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blackwright authored Jul 18, 2020
1 parent f5b186c commit 4a13647
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 4a13647

Please sign in to comment.