-
-
Notifications
You must be signed in to change notification settings - Fork 926
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
Mithril not respecting base href #2377
Comments
Hi @volnei! When using non-prefixed route mode, you will need to include the entire path for each route. If you want to prefix your Mithril routes with whatever path the page resolved on, you can access the current path with |
@barneycarroll thanks for your quick response!! So, I need to map and reference the /lang part in any of my routes and links? Like this? m.route.prefix("")
m.route(document.querySelector("#main"), "/en/", {
"/en/": layout(site),
"/en/login": layout(login)
} Theres no way to make it more generic? |
I think so. I thought for a moment it would be possible to put the language prefix as |
Yes, I've tried this a minute ago, but not work too. |
Hi @volnei , i'm not sure what you are going to achieve, but can't you use just language placeholders and drop the whole "base href"? So
Within your app, you will get vnode.attrs.lang as an interpolated value from ":lang" definition within the routes. |
Closing due to age. |
Mithril Version: 2.0.0-rc3
2.0.0-rc3
Im developing a multi language app using mithril where witch language have your directory. Eg.: /en/ /pt/ etc.
When running the application using Nginx and following http://localhost/pt/ the navigator is redirected to http://localhost.
The html file is:
And the mithril config is:
But in browser, the lang part for url is not respected and its automatically redirected to /.
Can anyone help me?
Thanks
The text was updated successfully, but these errors were encountered: