Skip to content
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

Offer href in urlParsed #1630

Closed
openscript opened this issue May 2, 2024 · 5 comments
Closed

Offer href in urlParsed #1630

openscript opened this issue May 2, 2024 · 5 comments
Labels
enhancement ✨ New feature or request

Comments

@openscript
Copy link

Description

In my opinion urlParsed should contain a href. My reasoning is URL also contains that and the DX would improve.

For example https://vike.dev/i18n describes:

const urlWithoutLocale = `${origin || ''}${pathnameWithoutLocale}${searchOriginal || ''}${hashOriginal || ''}`

This would become

const urlWithoutLocale = url.href.replace(url.pathname, url.pathnameWithoutLocale)
@openscript openscript added the enhancement ✨ New feature or request label May 2, 2024
@brillout
Copy link
Member

brillout commented May 2, 2024

Agreed 👍 Would you be up for PR for this as well? AFAICT this one should actually be fairly easy (easier than the other one).

(On a tangent, I was thinking it would also be nice to offer/document an easier way to manipulate the URL. The issue with url.href.replace(url.pathname, url.pathnameWithoutLocale) is that it may fail for example for a url.pathname that is /en and a URL /en?movies/endeavour which would become /?movies/deavour.)

@openscript
Copy link
Author

Would you be up for PR for this as well?

Sure, I'll give it a try. :)

@brillout
Copy link
Member

Done & released, see modifyUrl() at https://vike.dev/i18n.

Btw. would your company be up for sponsoring (#1350)? It makes a foundamental difference!

@openscript
Copy link
Author

openscript commented Jul 19, 2024

Thank you very much for implementing the feature!

Btw. would your company be up for sponsoring (#1350)? It makes a foundamental difference!

Absolutely. When we earn the first time money with a project where Vike is involved, we will do that.

@brillout
Copy link
Member

Absolutely. When we earn the first time money with a project where Vike is involved, we will do that.

Thank you, that's much appreciated 💚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants