AlexxNB / tinro

Highly declarative, tiny, dependency free router for Svelte's web applications.
MIT License
669 stars 30 forks source link

Relative paths #29

Closed jacobmischka closed 3 years ago

jacobmischka commented 3 years ago

According to the README and my testing, tinro only treats links that begin with a / as internal. This means that relative links, like navigating from /items/ to /items/12 using an href="12" triggers a full page reload.

It would be nice if paths that don't begin with a protocol (http:// or just //) were treated as internal, or if there were some way to opt into this behavior (an internal attribute on the anchor tag, for example).

Thanks for the great library!

AlexxNB commented 3 years ago

Thank you! Fixed in 0.4.3. Use native relative links, they will be handled by the router.

akvadrako commented 2 years ago

Does this mean this part of the README is now wrong:

When the href attribute starts with a single / (like /mypage or just /), it will be treated as an internal link which will be matched with defined routes. Other cases do not affect the links' behavior.

AlexxNB commented 2 years ago

@akvadrako yes, thanks. Fixed Readme.