Absolute URLs don't work with V8 anymore.
See original GitHub issueHi there! Have been using navigo for years with a lot of Sites I built with WordPress. I was initializing it with
const navigo = new Navigo(GLOBALS.homeUrl, false);
GLOBALS.homeUrl
being the URL that the WordPress Template Tag home_url(‘/’) would return.
Later in my script I would navigate links manually:
...
navigo.navigate( url, true ); // the second parameter navigates using absolute URLs in v7, which are standard in WordPress
...
How would I do that with Navigo v8? I couldn’t find anything in the documentation. The current behavior is that the full URL is being appended to the current one when navigating a link.
Expected behavior
GLOBALS.homeUrl: https://my-site.com/my-path/
Link URL: https://my-site.com/my-path/my-sub-path/
Result of navigate
: https://my-site.com/my-path/my-sub-path/
Current behavior
Result of navigate
: https://my-site.com/my-path/https://my-site.com/my-path/my-sub-path/
See how the full URL gets appended?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Exactly! Good one.
Hi @krasimir , thanks for pointing out that in my use case I indeed didn’t need a fully fledged router like Navigo. This is what I went with:
Works great! And it’s so tiny 🤦♂️😄 …one less dependency 🥳