asa
11 Maggio 2026, 12:43pm
5
Ho inviato una Pull Request per risolvere il problema nel repository di Discourse:
main ← asa0w0:main
offen 12:40PM - 11 May 26 UTC
## Problem
The AI localization feature currently generates `hreflang` tags usin… g underscores (e.g., `pt_BR`). According to ISO 639-1 and SEO standards, search engines like Google expect hyphens (e.g., `pt-BR`). This causes validation errors in tools like PageSpeed Insights and Google Search Console ("Unexpected language code").
## Solution
This PR applies `.tr('_', '-')` to the `locale` string within the `hreflang` attribute. This ensures that:
1. The `href` URL remains functional (still using the internal underscore format for the parameter).
2. The `hreflang` metadata becomes SEO-compliant by using the hyphen format.
## Validation
Confirmed that this change transforms codes like `pt_BR` into `pt-BR` in the rendered HTML header, resolving the "Unexpected language code" error.
Questa modifica garantisce che l’attributo hreflang sia conforme agli standard SEO, mantenendo al contempo funzionanti i parametri di localizzazione interni.
1 Mi Piace