Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify route precedence in routing.mdx #6545

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/content/docs/en/core-concepts/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ It's possible for multiple defined routes to attempt to build the same URL path.
- [...slug].astro
</FileTree>

Astro needs to know which route should be used to build the page. To do so, it sorts them according to the following rules in order:
Astro needs to know which route should be used to build the page. To do so, it sorts the routes according to the following rules (if two rules apply, the one that comes first in the following list takes precedence):

- Routes with more path segments will take precedence over less specific routes. In the example above, all routes under `/posts/` take precedence over `/[...slug].astro` at the root.
- Routes with more path segments will take precedence over routes with fewer path segments. In the example above, all routes under `/posts/` take precedence over `/[...slug].astro` at the root.
- Static routes without path parameters will take precedence over dynamic routes. E.g. `/posts/create.astro` takes precedence over all the other routes in the example.
- Dynamic routes using named parameters take precedence over rest parameters. E.g. `/posts/[page].astro` takes precedence over `/posts/[...slug].astro`.
- Pre-rendered dynamic routes take precedence over server dynamic routes.
Expand Down