Skip to content

Commit

Permalink
Add docs about basename.
Browse files Browse the repository at this point in the history
  • Loading branch information
futursolo committed Dec 18, 2021
1 parent 78798c4 commit 94332d7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions website/docs/concepts/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,22 @@ pub fn app() -> Html {
}
```

### Basename

It's possible to define a basename with `yew-router`.
A basename is a common prefix of all routes. Both the Navigator API and
`<Switch />` component respect basename setting. All pushed routes will be
prefixed with the basename and all switches will strip the basename before
trying to parse the path into a `Routable`.

If a basename prop is not supplied to the Router component, it will use
the href attribute of the `<base />` element in your html file and
fallback to `/` if no `<base />` presents in the html file.

## Relevant examples

- [Router](https://github.com/yewstack/yew/tree/master/examples/router)

## API Reference

- [yew-router](https://docs.rs/yew-router/)

0 comments on commit 94332d7

Please sign in to comment.