Closed MariaAndreyeva closed 3 weeks ago
These warnings should only be triggered when either localeHead
or setI18nParams
features are used, if you're not using these features could you provide a minimal reproduction? π
Would you be able to provide a reproduction? π
We are using the useSetI18nParams
function to set translated parameters for the current route. Our application supports five languages: Dutch (nl), German (de), French (fr), Portuguese (pt), and English (en). However, for certain routes, only specific languages are available.
For example, for the /home
route (where "home" is a dynamic slug parameter), only English (en) and Dutch (nl) are available. Therefore, we call setI18nParams({ nl: { slug: 'home' }, en: { slug: 'home' } })
.
Expected Behavior:
The application should only generate hreflang
and og:locale
tags for the available languages, which in this case are "en" and "nl".
Current Behavior:
Despite specifying only "en" and "nl", the HTML generated includes hreflang
and og:locale
tags for all five languages. Here are the problematic links:
<link id="i18n-alt-en" rel="alternate" href="/en/home" hreflang="en">
<link id="i18n-alt-en-NL" rel="alternate" href="/en/home" hreflang="en-NL">
<link id="i18n-alt-nl" rel="alternate" href="/nl/home" hreflang="nl">
<link id="i18n-alt-nl-NL" rel="alternate" href="/nl/home" hreflang="nl-NL">
<link id="i18n-alt-pt" rel="alternate" href="/pt/home" hreflang="pt">
<link id="i18n-alt-pt-BR" rel="alternate" href="/pt/home" hreflang="pt-BR">
<link id="i18n-alt-de" rel="alternate" href="/de/home" hreflang="de">
<link id="i18n-alt-de-DE" rel="alternate" href="/de/home" hreflang="de-DE">
<link id="i18n-alt-fr" rel="alternate" href="/fr/home" hreflang="fr">
<link id="i18n-alt-fr-FR" rel="alternate" href="/fr/home" hreflang="fr-FR">
<link id="i18n-xd" rel="alternate" href="/en/home" hreflang="x-default">
<link id="i18n-can" rel="canonical" href="/nl/home">
<meta id="i18n-og-url" property="og:url" content="/nl/home">
<meta id="i18n-og" property="og:locale" content="nl_NL">
<meta id="i18n-og-alt-en-NL" property="og:locale:alternate" content="en_NL">
<meta id="i18n-og-alt-pt-BR" property="og:locale:alternate" content="pt_BR">
<meta id="i18n-og-alt-de-DE" property="og:locale:alternate" content="de_DE">
<meta id="i18n-og-alt-fr-FR" property="og:locale:alternate" content="fr_FR">
As seen above, tags for "pt", "de", and "fr" are included even though these languages are not available for the /home
route.
Steps to Reproduce:
useSetI18nParams({ nl: { slug: 'home' }, en: { slug: 'home' } })
./home
route.We need to ensure that only the specified languages ("en" and "nl") have corresponding hreflang
and og:locale
tags in the HTML. The tags for unavailable languages ("pt", "de", "fr") should not be generated. Alternative is to disable seo without a warning.
If you feel that our configuration is wrong or we are missing something, please, let us know. Any guidance or suggestions would be greatly appreciated.
@BobbieGoede , please, check the comment above. Let me know if reproduction is still needed.
So the warnings are not the issue since you are using SEO features. The issue you're describing sounds similar to https://github.com/nuxt-modules/i18n/issues/2782 so I'm closing this to track it there instead, let me know if this is issue is not quite the same in which case I'll reopen.
Hello,
I am using the Nuxt i18n module in my project and I have come across an issue regarding SEO features. According to the documentation, to leverage SEO benefits, the
locales
option must be configured as an array of objects with each object having alanguage
option set to the locale language tags: SEO Requirements Documentation.However, I do not intend to use the SEO benefits such as hreflang alternate link generation and canonical link generation. Therefore, I have removed the
language
options from my configuration. Despite this, I still receive the following warning in the console:Expected Behavior:
I would expect that if SEO features are not needed or explicitly disabled, there should be no warnings related to SEO in the console.
Actual Behavior:
Even after removing
language
options, I still receive warnings in the console related to SEO features.Steps to Reproduce:
locales
option withoutlanguage
in the Nuxt i18n module.Example Configuration:
Console Warning:
Environment Information:
Nuxt Version: 3.13.2 Nuxt i18n Module Version: 8.5.5 Node.js Version: 20.10.0 Operating System: macOS
Feature Request:
Is it possible to provide a way to completely disable SEO features, including the suppression of any related warnings, when they are not needed? This would help in keeping the console clean and avoid any unnecessary warnings.
Thank you for considering this request. I appreciate the work that has gone into this module and look forward to any updates or guidance on this matter.
Best regards, Maria