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

Add the query strategy #3275

Open
3 of 4 tasks
Ionys320 opened this issue Dec 22, 2024 · 0 comments
Open
3 of 4 tasks

Add the query strategy #3275

Ionys320 opened this issue Dec 22, 2024 · 0 comments

Comments

@Ionys320
Copy link

Ionys320 commented Dec 22, 2024

Describe the feature

For the moment, in order to be SEO compliant, we need to use prefix strategies, making the URLs a bit long (https://mydomain.com/en/meowmeow). Even if there are strategies that can avoid /en/ if it's the default language, it will still be displayed for others locales.

That's why I suggest the implementation of the query strategy. Using it, my previous URL would looks like https://mydomain.com/meowmeow?i18n=en, making it shorter. It could even write the language into the i18n cookie, and therefore avoid needing it after.

For the moment, I tried to add a middleware and the no_prefix strategy, but even if it can correctly detect the query parameter and save it for later, it's unfortunately not SEO compliant because useLocaleHead is not handling it as I would like (which is normal ofc).

I wonder how much work it could take. Because I make this suggestion, I may handle it, but I guess adding strategies is a big stuff, so maybe I would need help. But in summary, it's an extension of the no_prefix strategy to have something SEO compliant.

Regarding the specs, I imagined:

  • When no query is passed: work as the no_prefix (depending of the config module), in order to detect user language, then store it in a cookie
  • Else, translate the page as requested, and save/override the language using the cookie (if set).
  • In useLocaleHead, we'll need to remove all the query + add this one.
  • The query parameter must be configurable (to be locale, i18n, lang, etc)
  • The query parameter would always be present when using NuxtLinkLocale and useLocalePath. Dev can remove it by avoid using both of them.

Because this strategy doesn't use any prefix, it'll need several changes to handle it correctly, but I think I could take care of that.

Thanks for reading me!

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant