-
-
Notifications
You must be signed in to change notification settings - Fork 499
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
Adding hreflang alternate links in head #14
Comments
Hi @lucpotage |
@paulgv the
Note the empty |
Thanks @matsrietdijk ! It should be fixed in v2.3.0! |
@paulgv currently on v5.4.4 and again for ignored pages (by setting |
@matsrietdijk I have the same issue. Have you solved that issue somehow? |
@bangjelkoski currently I disabled SEO all together and rolled my own plugin to add the correct tags/attributes. So not ideal but it does the job. |
@matsrietdijk I did the same. I am still not in production so I dont need SEO at the moment but I hope this issue will be resolved. @paulgv can you please have a look? |
@paulgv This is a serious issue not just because of the broken tags but also because it generates thousands of warnings which really causes high cpu usage and makes the app slow. |
Ok, I think I found a solution to the problem, in head() {
return {
link: this.$nuxtI18nSeo().link.filter(
(item) => (item.rel = 'alternate' && item.hreflang)
),
}
}, This option will dynamically create links, so far I see the solution to this problem like this.Hope helped. |
I was able to fix this issue like so: in
Then in
Last set your
|
I'm trying to automatically add the hreflang links in the head but it's not that easy.
I moved the locales array outside of the
module.exports
and added the following code in thenuxt.config.js
file and it kinda works:However, I didn't find a way to dynamically change the
href
value. The methodswitchLocalePath()
is not accessible from thenuxt.config.js
file and it seems we can't access tothis.$route.name
too.Any idea on how to do that? What about
nuxt-i18n
injecting theses alternate links by default since Nuxt is sold as SEO-friendly out of the box. It would be a great addition to the module.Finally an unrelated question. Why nuxt-i18n is not a scoped package like the sitemap module for instance
@nuxtjs/sitemap
?The text was updated successfully, but these errors were encountered: