{"id":20581,"date":"2020-01-30T13:34:46","date_gmt":"2020-01-30T13:34:46","guid":{"rendered":"https:\/\/www.arimetrics.com\/glosario-digital\/hreflang"},"modified":"2026-09-28T13:38:02","modified_gmt":"2026-09-28T13:38:02","slug":"hreflang","status":"publish","type":"encyclopedia","link":"https:\/\/www.arimetrics.com\/en\/digital-glossary\/hreflang","title":{"rendered":"Hreflang"},"content":{"rendered":"<p><img decoding=\"async\" class=\"boxpad alignright wp-image-14444 size-full\" src=\"https:\/\/www.arimetrics.com\/wp-content\/uploads\/2020\/01\/hreflang-1.png\" alt=\"Hreflang\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.arimetrics.com\/wp-content\/uploads\/2020\/01\/hreflang-1.png 300w, https:\/\/www.arimetrics.com\/wp-content\/uploads\/2020\/01\/hreflang-1-150x150.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><strong>Definition:<\/strong><\/p>\n<p><strong>Hreflang<\/strong> is an attribute that tells Google which alternative versions of a page are intended for different languages or regions. It connects URLs with equivalent content so the search engine can show the variant it considers most appropriate for a user&#8217;s language and, when specified, location.<\/p>\n<p>Hreflang does not translate a page, change its content, or automatically redirect a visitor. <strong>Its purpose is to describe the relationship between localized versions in search<\/strong>, not to choose which version a browser must open or to guarantee a particular ranking.<\/p>\n\n<h2>How hreflang works<\/h2>\n<p>The implementation creates a set of alternative URLs. Each page must declare its own URL and the other variants that belong to the set. <strong>References must be reciprocal:<\/strong> if the Spanish version points to the English version, the English version must also point to the Spanish version.<\/p>\n<p>The specified URLs must be absolute, including the protocol and domain. Versions can be located in directories, subdomains, country-code domains, or even different domains. <strong>The URL structure does not determine the language or region by itself<\/strong>, so the attribute makes that correspondence explicit.<\/p>\n<p>Google can discover alternative versions without hreflang, but a correct declaration helps it interpret their relationship. If return links are missing, codes are invalid, or a URL cannot be crawled, <strong>the affected annotations may be ignored<\/strong> without necessarily causing an indexing problem for the entire site.<\/p>\n<h2>Language, region, and x-default codes<\/h2>\n<p>An hreflang value contains a language code and can include a regional code. <strong>The language is required and the region is optional<\/strong>, so using a country alone is not valid.<\/p>\n<ul>\n<li><strong>Language:<\/strong> Usually uses an ISO 639-1 code, such as <code>es<\/code>, <code>en<\/code>, <code>fr<\/code>, or <code>de<\/code>.<\/li>\n<li><strong>Language and region:<\/strong> Combines the language with an ISO 3166-1 Alpha 2 code, such as <code>es-MX<\/code>, <code>en-GB<\/code>, or <code>fr-CA<\/code>.<\/li>\n<li><strong>Script variation:<\/strong> Can use an ISO 15924 code when writing systems need to be distinguished, such as <code>zh-Hans<\/code> and <code>zh-Hant<\/code>.<\/li>\n<li><strong>Capitalization:<\/strong> Values are case-insensitive, although the usual convention writes the region in uppercase.<\/li>\n<li><strong>x-default:<\/strong> Identifies a fallback URL for users whose language or region does not match a specific variant.<\/li>\n<\/ul>\n<p>A generic version can coexist with regional variants. For example, <code>es<\/code> can target Spanish speakers without a specific region, while <code>es-MX<\/code> identifies a version prepared for Mexico. <strong>Regional differences should actually exist on the page<\/strong>, such as currency, availability, terms, or vocabulary, rather than being limited to a different code.<\/p>\n<h2>Implementation methods<\/h2>\n<p>Google supports three methods for communicating localized versions. <strong>All three are equivalent from a search perspective<\/strong>, so it is usually best to choose the one that is easiest to maintain.<\/p>\n<ul>\n<li><strong>HTML:<\/strong> Add <code>link<\/code> elements with <code>rel=\"alternate\"<\/code>, the <code>hreflang<\/code> value, and the alternative URL inside the <code>head<\/code> of each page.<\/li>\n<li><strong>HTTP header:<\/strong> Send the alternatives through the <code>Link<\/code> header, an option that is especially useful for non-HTML files such as PDF documents.<\/li>\n<li><strong>XML sitemap:<\/strong> Include <code>xhtml:link<\/code> elements with every variant for each URL in the <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/sitemap\">sitemap<\/a>.<\/li>\n<\/ul>\n<p>A basic pair of pages could declare <code>hreflang=\"es\"<\/code> for the Spanish URL and <code>hreflang=\"en\"<\/code> for the English URL. Both must include the same set as well as a reference to themselves. <strong>Combining all three methods provides no additional search benefit<\/strong> and can increase inconsistencies if their values do not match.<\/p>\n<h2>Relationship with canonical and localized content<\/h2>\n<p>Hreflang and <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/rel-canonical\">rel canonical<\/a> serve different purposes. Canonical identifies the preferred URL among duplicate or very similar pages, while hreflang connects alternatives intended for language or regional audiences. <strong>A localized page should normally use a self-referencing canonical<\/strong>, rather than pointing its canonical to another language version that is intended to remain in search results.<\/p>\n<p>Alternatives should represent essentially the same page or need, although they can adapt prices, currency, availability, examples, or regional terms. Hreflang should not connect a product page in one language with a category or a different article in another. <strong>Equivalence is assessed through purpose and main content<\/strong>, not only through the URLs&#8217; positions within the site.<\/p>\n<p>Google determines language from visible content, not from hreflang or only from the HTML <code>lang<\/code> attribute. If only the navigation is translated and the main content remains the same, the pages may still be treated as duplicates. <strong>Hreflang does not replace genuine content localization.<\/strong><\/p>\n<h2>Common errors and verification<\/h2>\n<p>Errors usually appear when the page set is no longer consistent. <strong>A review must check every URL and every relationship<\/strong>, not just the presence of a tag on one version.<\/p>\n<ul>\n<li><strong>Missing self-reference:<\/strong> A page lists other variants but does not include itself.<\/li>\n<li><strong>No return link:<\/strong> One version points to another that does not return the reference.<\/li>\n<li><strong>Incorrect codes:<\/strong> A region is used without a language, an unsupported code is entered, or language and country are confused.<\/li>\n<li><strong>Relative or defective URLs:<\/strong> The protocol or domain is missing, the URL contains a typo, or it redirects to a different destination.<\/li>\n<li><strong>Different sets:<\/strong> Equivalent pages list incompatible groups of alternatives.<\/li>\n<li><strong>Conflicting canonical:<\/strong> The URL declares another version as canonical even though it should remain an independent alternative.<\/li>\n<li><strong>Unavailable pages:<\/strong> Alternatives return errors, are blocked, contain <code>noindex<\/code>, or cannot be crawled.<\/li>\n<li><strong>Incorrect matching:<\/strong> Pages that do not satisfy the same intent or are not equivalent versions are connected.<\/li>\n<\/ul>\n<p>Verification can examine rendered HTML, HTTP headers, or the sitemap, as well as crawl a complete sample of sets and their responses. <a href=\"https:\/\/developers.google.com\/search\/docs\/specialty\/international\/localized-versions\" target=\"_blank\" rel=\"noopener\">Google&#8217;s documentation on localized versions<\/a> describes the supported formats and codes. <strong>A valid implementation supports selection of the appropriate version, but it does not guarantee traffic, conversions, or automatic ranking improvements.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hreflang connects page versions by language or region. Learn its codes, implementation methods, canonical relationship, x-default, and common errors.<\/p>\n","protected":false},"author":6,"featured_media":80924,"template":"","encyclopedia-tag":[515],"class_list":["post-20581","encyclopedia","type-encyclopedia","status-publish","has-post-thumbnail","hentry","encyclopedia-tag-indexing"],"_links":{"self":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia\/20581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia"}],"about":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/types\/encyclopedia"}],"author":[{"embeddable":true,"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/users\/6"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/media\/80924"}],"wp:attachment":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/media?parent=20581"}],"wp:term":[{"taxonomy":"encyclopedia-tag","embeddable":true,"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia-tag?post=20581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}