-
Notifications
You must be signed in to change notification settings - Fork 126
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
i18n Multilingual Nuxt Website - The right way - rel-alternate-hreflang #91
Comments
Hi! If not translated URLs, at least it should use language suffixes like |
I am not sure I get what you mean. Do you mind rephrasing? |
Hi, I mean that instead of this:
we should at least have:
But you can consider it as two separate issues probably. |
@JacekZakowicz That is one main aspect of my proposition. (: You explicitly displayed the root problem. So thank you for that. Right now, every locale is its own, which is technically bad for SEO. My proposition above would fix that. And without canonical nonsense as a bonus (which are now not recommended between translated pages). |
I'd need this too ! Is this available in the current version ? |
@nicolas-giuristante Thank your for this great idea 👍 I'm starting to do some tests with sitemap + nuxt-i18n. The first results are on the right track! But I'm not sure to understand when to push the "x-default" value, depending on each strategy. For eg. with the following nuxt-i18n config, see bellow each routes generated by strategy: i18n: {
defaultLocale: 'en',
locales: ['en', 'es', 'fr'],
strategy: ...
}
{ name: 'about___en', url: '/about/' },
{ name: 'about___es', url: '/es/about/' },
{ name: 'about___fr', url: '/fr/about/' }
{ name: 'about___en', url: '/en/about/' },
{ name: 'about___es', url: '/es/about/' },
{ name: 'about___fr', url: '/fr/about/' }
{ name: 'about___en___default', url: '/about/'}
{ name: 'about___en', url: '/en/about/' },
{ name: 'about___es', url: '/es/about/' },
{ name: 'about___fr', url: '/fr/about/' } So, from my understanding, the "x-default" should be only available for the last strategy "prefix_and_default", with a generated sitemap.xml as follows: <url>
<loc>http://localhost:3000/en/about/</loc>
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3000/about/" />
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3000/en/about/" />
<xhtml:link rel="alternate" hreflang="es" href="http://localhost:3000/es/about/" />
<xhtml:link rel="alternate" hreflang="fr" href="http://localhost:3000/fr/about/" />
</url> |
any news about this feature ? |
@damienroche coming soon! You can test the feature branch with |
Hi @NicoPennec My nuxt.config.js file looks like this :
|
@damienroche my bad... I just pushed a fix. |
Just tried it:
Otherwise did work as advertised. |
Many thanks for your feedback @mccare 🙏
|
This feature is available since the release 2.3.0. Thank @nicolas-giuristante for your proposal and @damienroche @mccare for the review 🙏 |
@b-jan your console errors are about a chrome extension. Then, your output seems good. It's only a rendering issue on your browser, due to the xml namespace of the elements xhtml:link. Your browser will convert the XML rendering to a XHTML page rendering because it see a know "xhtml:*" namespace. Check the source code of the sitemap.xml, you will see that your XML file is correct. |
Thanks @NicoPennec it is perfect :) |
Thank you @NicoPennec and all others who participated for this integration. I'm sorry for my lack of feedback and update on one of my own initial initiative. In any case, I am glad it was considered and built in the meantime, simply amazing! I am sure it will benefit a lot people in the long run. |
What problem does this feature solve?
Hello! 👋🏼
Proposition : Automatically generate adequate sitemap with the concept rel-alternate-hreflang proposed by Google itself when using
nuxt-i18n
paths feature.Why : Multilingual website cannot benefit from this plugin's automatic sitemap generation at the moment without heavy modifications/custom code. It would greatly help newcomers that doesn't know how to code this properly AND devs who do not know SEO's current best practices towards multilingual websites.
Source : Tell Google about localized versions of your page[https://support.google.com/webmasters/answer/189077?hl=en]
I am sure this can be implemented easily.
nuxt-i18n
is already supporting this rel-alternate-hreflang concept withlink
tags in thehead
.What does the proposed changes look like?
Exemple
Would generate
Root page x-default when all locales are prefixed
Bonus point if you could support for the newest
x-default
value on root when i18n's optionstrategy
=prefix
The text was updated successfully, but these errors were encountered: