Incorrect route matching with subfolder root
See original GitHub issueHello Krasimir,
I deployed a site on Github Pages inside a subfolder and set Navigo’s root to that subfolder i.e. new Navigo('/bohemica-studio-website')
.
I am getting a wrong match for Navigo links when the href
path is (correctly) set to "bohemica-studio-website/en/projects/branding"
. The matching route should be bohemica-studio-website/:language/projects/:name
, but it ends up being bohemica-studio-website/*
.
Interestingly, when I call the router.match('bohemica-studio-website/en/projects/branding')
, I get the correct route. Same, when I set the link without the root path i.e. "en/projects/branding"
Maybe, there is some wrong deployment setting, but I feel that Navigo is being fed the right data, so it’s likely an internal issue. What do you think?
Thank you ✌️
P.S. Everything works fine on localhost when the root path is set to '/'
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
I swapped the project a custom domain (and root folder), so I cannot test it. But it looks good and would consider it fixed👍
I see @stepanjakl. I would rather patch the generate method so it returns the path without app than forcing the full url path on the links. Conceptually the idea of Navigo is to be an app oriented. It shouldn’t know about the rest of the world. So I’ll probably provide an additional argument to the generate function which will strip the root.