SEO · Checked on every page
Canonical / hreflang consistencyWhat it checks and how to fix it
What it checks
Runs on pages that have both hreflang tags and a canonical URL. Warns when the canonical URL is not one of the page's hreflang alternates (nor its x-default), or when it is the alternate of a different language than the page's own lang attribute. Passes otherwise.
Why it matters
Google only honours hreflang when each page's canonical is part of the hreflang set; if it is not, the whole cluster of language alternates is ignored. A canonical pointing at another language is worse: canonical wins over hreflang, so the translated page is treated as a duplicate and disappears from search results in its own language.
How to fix it
Make each language version canonical to itself, and list that same URL in its hreflang set.
<!-- On https://example.com/es/precios -->
<link rel="canonical" href="https://example.com/es/precios">
<link rel="alternate" hreflang="en" href="https://example.com/pricing">
<link rel="alternate" hreflang="es" href="https://example.com/es/precios">
<link rel="alternate" hreflang="x-default" href="https://example.com/pricing">
Never point the canonical of a translation at the default-language page. In Rails, build the canonical from the
current request rather than from a fixed locale:
<link rel="canonical" href="<%= request.base_url + request.path %>">