nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.76k stars 485 forks source link

Improve SEO: new browser detection mode: `onlyOnCookie` #1019

Closed husayt closed 3 years ago

husayt commented 3 years ago

Is your feature request related to a problem? Please describe.

There were a number of SEO related changes in recent releases. onlyOnRoot has improved things greatly, but sometimes even more restrictive mode is needed, especially if no_prefix default language is not english. So for this reason we want to disable detectBrowserLanguage if there is no cookie set (to make sure crawlers are not redirected.)

Describe the solution you'd like

add a new mode to detectBrowserLanguage - onlyOnCookie. This will behave in a following way:

divine commented 3 years ago

Hello,

onlyOnNoPrefix option probably does everything you've asked?

Thanks!

husayt commented 3 years ago

Hi, onlyOnNoPrefix is even less restrictive than onlyOnRoot. I am looking for opposite.

İ don't want any browser detection if there is no cookie set. Basically that will make sure that crawlers are not affected.

Thanks

rchl commented 3 years ago

What you want is to basically never detect browser language but only use the cookie to store the last-used one. So that wouldn't really belong in detectBrowserLanguage object, I feel.

And in that case you can probably just implement that logic yourself by storing the cookie on page load if not set and restoring locale from cookie if set.