{"id":24933,"date":"2024-08-30T21:16:09","date_gmt":"2024-08-30T11:16:09","guid":{"rendered":"https:\/\/digitalnomadshq.com.au\/?post_type=glossary&#038;p=24933"},"modified":"2025-12-22T16:14:41","modified_gmt":"2025-12-22T06:14:41","slug":"hreflang","status":"publish","type":"glossary","link":"https:\/\/digitalnomadshq.com.au\/glossary\/hreflang\/","title":{"rendered":"Hreflang"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What is Hreflang?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Hreflang is an HTML attribute that tells search engines about the different versions of a page tailored for various languages or regions. This helps Google deliver the correct localised version to users.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can apply the hreflang attribute in three ways:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>HTML tags<\/li>\n\n\n\n<li>HTTP headers<\/li>\n\n\n\n<li>Sitemaps<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">What Is an Example of a Hreflang?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">An example of a hreflang tag is as follows:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>&lt;link rel=\"alternate\" href=\"https:\/\/example.com\/fr\/\" hreflang=\"fr\" \/&gt;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This tag indicates that the URL &#8220;https:\/\/example.com\/fr\/&#8221; is the French version of the page. The <code>hreflang=\"fr\"<\/code> attribute tells search engines to serve this version of the page to users searching in French.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Importance of Hreflang for SEO<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Hreflang is important for SEO because it helps search engines identify and serve the appropriate localised version of your pages based on the user&#8217;s language and\/or region.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s key to international SEO, especially when expanding your online presence across multiple countries. Additionally, hreflang pages share each other&#8217;s ranking signals, which can impact your search rankings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">According to Google\u2019s Gary Illyes, the page that best matches the search query will determine the ranking position, but the most relevant page for the user will be shown in the SERPs. Therefore, hreflang tags can have a direct influence on your rankings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Additionally, hreflang is an effective way to resolve duplicate content issues on your site. For instance, if you\u2019re targeting audiences in the US and UK with two different versions of the same page\u2014where only minor differences like spellings and currencies exist\u2014the rest of the content would be identical.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By using hreflang, you signal to Google that these are two distinct versions. Without it, Google might view these pages as duplicates and index only one, leading to losing visibility and traffic for the other.<\/p>\n\n\n\n<div style=\"height:32px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Hreflang Best Practices<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Always Use a Self-Referencing Hreflang Tag<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When applying hreflang tags to a page, ensure each page includes a self-referencing hreflang link. This means the page must reference itself and the alternate versions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, if your site has English and Italian versions of a page:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>English: <code>https:\/\/example.com\/hello<\/code><\/li>\n\n\n\n<li>Italian: <code>https:\/\/example.com\/ciao<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The English version should include the following hreflang tags:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>&lt;link rel=\"alternate\" hreflang=\"it\" href=\"https:\/\/example.com\/ciao\" \/&gt; &lt;link rel=\"alternate\" hreflang=\"en\" href=\"https:\/\/example.com\/hello\" \/&gt;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While some SEOs consider this an optional practice, Google\u2019s guidelines recommend it as essential.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ensure Valid Language and Region Codes<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Googlebot identifies the hreflang attribute using language and region codes. The language code must follow the ISO 639-1 format, and the region code should adhere to the ISO 3166-1 Alpha 2 format.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The language code is mandatory, while the region code is optional. If only one code is specified, Google assumes it&#8217;s the language code. Therefore, it&#8217;s crucial to use the correct format for these codes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For instance, if you&#8217;re targeting the UK, the correct language-location code is <code>en-gb<\/code>, not <code>en-uk<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Add an \u201cx-default\u201d Tag for Unmatched Languages<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>x-default<\/code> hreflang tag informs Google that the page should be shown to users whose languages are not specified in the hreflang tags. It acts as a fallback page for unmatched languages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While not mandatory, Google recommends using the <code>x-default<\/code> tag. It looks like this:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>&lt;link rel=\"alternate\" hreflang=\"x-default\" href=\"https:\/\/example.com\/\" \/&gt;<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ensure Identical Hreflang Tags Across All Page Versions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To maintain accuracy, the set of hreflang tags should be identical across all page versions. This means every group page must include the same set of hreflang links.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, if your blog homepage has six language versions, each localised version should include the same set of seven hreflang links (six languages plus the <code>x-default<\/code>).<\/p>\n\n\n\n<div style=\"height:32px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">What Is the Difference Between Href and Hreflang?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Href<\/strong> is an HTML attribute used in <code>&lt;a&gt;<\/code> tags to link to other pages or sections. For example:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>&lt;a href=\"https:\/\/example.com\"&gt;Visit Example&lt;\/a&gt;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Hreflang<\/strong> is an attribute used in <code>&lt;link&gt;<\/code> tags to indicate the language and regional targeting of a page. It&#8217;s essential for websites with localised content to ensure users see the correct version of the page. For example:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>&lt;link rel=\"alternate\" hreflang=\"en\" href=\"https:\/\/example.com\/en\/\" \/&gt;<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to Generate Hreflang Tags?<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Identify Codes:<\/strong> Use ISO 639-1 for language (e.g., &#8220;en&#8221;) and ISO 3166-1 Alpha 2 for region (e.g., &#8220;GB&#8221;).<\/li>\n\n\n\n<li><strong>Create Tags:<\/strong> For each page version, add a <code>&lt;link&gt;<\/code> tag with the correct <code>hreflang<\/code> value.<\/li>\n\n\n\n<li><strong>Use x-default:<\/strong> Include an <code>x-default<\/code> tag as a fallback for unmatched languages.<\/li>\n\n\n\n<li><strong>Validate:<\/strong> Ensure tags are correct using tools like Google Search Console.<\/li>\n<\/ol>\n","protected":false},"featured_media":0,"parent":0,"template":"","meta":{"_acf_changed":true,"content-type":""},"class_list":["post-24933","glossary","type-glossary","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/digitalnomadshq.com.au\/wp-json\/wp\/v2\/glossary\/24933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalnomadshq.com.au\/wp-json\/wp\/v2\/glossary"}],"about":[{"href":"https:\/\/digitalnomadshq.com.au\/wp-json\/wp\/v2\/types\/glossary"}],"wp:attachment":[{"href":"https:\/\/digitalnomadshq.com.au\/wp-json\/wp\/v2\/media?parent=24933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}