How to make sure hreflangs contain domain?
Google Lighthosue complains about SEO on my Nuxt3 page. The reason being is, they are not absolute URLs. This are the links generated in source:
and this is my nuxt.config i18n part:
7 Replies
is there an obvious config missing that makes hreflang relative instead of absolute?
You need to set the
differentDomains
flag if you want to utilize locale domainsThanks for reply! I have a single domain, locales are just subpath.
I got it to work in useHead() and manually adding domain to href
hacky, but works and SEO checks pass
What purpose does the domain key have in your locale config then?
I was just trying to get hreflang to work, this was one of the suggestions from... mr GPT 😉
it is gone now from config
Right. Wouldn’t it be easier to configure the
baseUrl
in i18n than using useHead?
As per the docs.
You must also set the baseUrl option to your production domain in order to make alternate URLs fully-qualified
🤦
this was the config bit that was missing from nuxt.config
thanks a lot!