From 94332d7c1427c62144d4be41bd0acee12f9c2136 Mon Sep 17 00:00:00 2001 From: Kaede Hoshikawa Date: Sat, 18 Dec 2021 15:21:55 +0900 Subject: [PATCH] Add docs about basename. --- website/docs/concepts/router.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/website/docs/concepts/router.md b/website/docs/concepts/router.md index 56acd3fc25c..17c6c5f5c50 100644 --- a/website/docs/concepts/router.md +++ b/website/docs/concepts/router.md @@ -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 +`` 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 `` element in your html file and +fallback to `/` if no `` 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/)