{"id":30205,"date":"2026-05-12T11:31:00","date_gmt":"2026-05-12T10:31:00","guid":{"rendered":"https:\/\/www.web-systems.pl\/hreflang-multilingual-website-language-versions\/"},"modified":"2026-10-13T14:55:58","modified_gmt":"2026-10-13T13:55:58","slug":"hreflang-multilingual-website-language-versions","status":"publish","type":"post","link":"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/","title":{"rendered":"Hreflang on a multilingual website: how to mark language versions"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Hreflang<\/strong> is an annotation that tells Google that several URLs are language versions of the same content. Based on it, the search engine decides which URL to show to a user from a given language or country. Sound familiar?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A customer from Germany types in your company name and lands on the Polish page instead of the German one. This usually means the annotations are missing or something in them is wrong. Below I describe how hreflang works, three ways to add it, what x-default is for, how to check the implementation and which mistakes happen most often.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/#What_is_hreflang_and_what_does_it_really_do_in_Google\" >What is hreflang and what does it really do in Google?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/#How_to_add_hreflang_tags_in_the_head_HTTP_headers_or_a_sitemap\" >How to add hreflang: tags in the head, HTTP headers or a sitemap?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/#Rules_for_a_correct_set_of_page_language_versions_in_Google\" >Rules for a correct set of page language versions in Google<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/#What_is_x-default_hreflang_for\" >What is x-default hreflang for?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/#Hreflang_in_WordPress_what_the_plugin_does_and_what_you_need_to_check\" >Hreflang in WordPress: what the plugin does and what you need to check<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/#The_most_common_hreflang_mistakes_and_how_to_catch_them\" >The most common hreflang mistakes and how to catch them<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/#Frequently_asked_questions\" >Frequently asked questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/#Does_hreflang_improve_a_sites_rankings_in_Google\" >Does hreflang improve a site&#8217;s rankings in Google?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/#Do_I_have_to_use_x-default\" >Do I have to use x-default?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.web-systems.pl\/en\/hreflang-multilingual-website-language-versions\/#Is_the_lang_attribute_in_the_html_tag_enough\" >Is the lang attribute in the html tag enough?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_hreflang_and_what_does_it_really_do_in_Google\"><\/span>What is hreflang and what does it really do in Google?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Hreflang shows Google the localized equivalents of a page, so that the URL in the user&#8217;s language appears in the search results. That&#8217;s all. It is not used to detect language (a common myth). According to <a href=\"https:\/\/developers.google.com\/search\/docs\/specialty\/international\/localized-versions\" rel=\"nofollow noopener\" target=\"_blank\">Google&#8217;s documentation on localized versions<\/a>, the search engine uses neither hreflang nor the HTML lang attribute for that, only its own algorithms. The annotation simply directs the right version to the right audience. When do you need it? When languages or regions have separate URLs, e.g. <em>\/de\/<\/em> and <em>\/en\/<\/em>, or separate domains.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_add_hreflang_tags_in_the_head_HTTP_headers_or_a_sitemap\"><\/span>How to add hreflang: tags in the head, HTTP headers or a sitemap?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Google accepts three methods: link tags in the head section, the HTTP Link header or <a href=\"https:\/\/www.web-systems.pl\/en\/xml-sitemap-what-to-include-how-to-submit\/\">an XML sitemap<\/a>. Pick one, the one that fits your site. Mixing them gains you nothing. The tags must sit in a correctly built head section, so if you have doubts, paste the rendered page code into an HTML validator. Also, do not combine hreflang with other attributes, e.g. media, in a single link tag. And the HTTP header? It comes in handy for PDF files and other documents that are not HTML. Every version returns exactly the same set in it.<\/p>\n\n\n\n<pre><code>&lt;link rel=\"alternate\" hreflang=\"pl\" href=\"https:\/\/example.com\/pl\/\" \/&gt;\n&lt;link rel=\"alternate\" hreflang=\"en\" href=\"https:\/\/example.com\/en\/\" \/&gt;\n&lt;link rel=\"alternate\" hreflang=\"de\" href=\"https:\/\/example.com\/de\/\" \/&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Rules_for_a_correct_set_of_page_language_versions_in_Google\"><\/span>Rules for a correct set of page language versions in Google<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every version of a page lists all the variants with full URLs, including itself. It sounds trivial, yet this is exactly where most implementations fall apart. In practice I recommend this order:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>List all the variants of a given subpage.<\/li>\n<li>Assign two-letter language codes according to the ISO standard and, if needed, add a region, e.g. <em>de-AT<\/em> for Austria.<\/li>\n<li>Use full, canonical URLs with the protocol.<\/li>\n<li>Add a link from the page to itself.<\/li>\n<li>Make sure it is reciprocal: the same set must be on every version.<\/li>\n<li>Add x-default for all other users.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">A separate story is similar content in the same language under different URLs, e.g. example.de\/ and example.com\/de\/. Here <a href=\"https:\/\/developers.google.com\/search\/docs\/specialty\/international\/managing-multi-regional-sites\" rel=\"nofollow noopener\" target=\"_blank\">Google&#8217;s guide to multi-regional sites<\/a> recommends choosing a preferred version and combining rel=canonical with hreflang. The result? The user gets the URL that matches their language or region.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_x-default_hreflang_for\"><\/span>What is x-default hreflang for?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The x-default value points to a fallback page for users whose language you do not support. It is most useful for a language selection page or for a homepage that redirects visitors on its own. Implementation is simple: next to the others, you add one more link tag with <em>hreflang=&#8221;x-default&#8221;<\/em>. It should point to the URL where someone speaking a language outside your list should land. A real-world example: the web-systems.pl homepage has pl, en, de and x-default annotations, and WPML generates them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Hreflang_in_WordPress_what_the_plugin_does_and_what_you_need_to_check\"><\/span>Hreflang in WordPress: what the plugin does and what you need to check<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Multilingual plugins such as WPML generate hreflang automatically. But only for pages with linked translations. If someone created the German version as a separate page, without connecting it to the Polish one, the plugin will not treat them as equivalents. And that subpage is left without annotations, and you do not even know about it. So after adding content, look into the code of a few of your most important URLs, it is five minutes of work. If you are only just choosing a tool, compare the available <a href=\"https:\/\/www.web-systems.pl\/en\/how-to-create-a-multilingual-wordpress-site\/\">WordPress translation plugins<\/a>. With a new site, it is best to plan the language structure already when you order <a href=\"https:\/\/www.web-systems.pl\/en\/website-and-online-store-development\/\">website development for your business<\/a>. Reworking it later is much harder.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_most_common_hreflang_mistakes_and_how_to_catch_them\"><\/span>The most common hreflang mistakes and how to catch them<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Most problems come from missing reciprocity, wrong language codes and URLs that redirect or have a different canonical. The list of sins looks more or less like this:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>no return link from one of the versions,<\/li>\n<li>a country code instead of a language code, e.g. <em>uk<\/em> for the United Kingdom instead of <em>en-GB<\/em>,<\/li>\n<li>hreflang pointing to a URL that redirects or has noindex,<\/li>\n<li>a canonical pointing to a different language version,<\/li>\n<li>tags outside the head section, e.g. injected into the body,<\/li>\n<li>relative URLs instead of full ones.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For checking, viewing the source of the rendered page and an HTML validator are entirely enough. With a large number of subpages, third-party hreflang debugging tools help. Just note: Google points out that it does not maintain or check them. On a large site, in my opinion it is better to order a <a href=\"https:\/\/www.web-systems.pl\/en\/seo-audits\/\">multilingual website SEO audit<\/a> than to click through it by hand for weeks.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Where to start? With a list of the variants of the homepage and the most important subpages. Then check in the code whether each of them lists all the versions and x-default. A well-implemented hreflang does one simple thing: a customer from Germany sees the German page in Google, and a customer from Poland sees the Polish one. If you prefer to hand this over to specialists, consider <a href=\"https:\/\/www.web-systems.pl\/en\/professional-website-positioning\/\">professional search engine optimization<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Frequently_asked_questions\"><\/span>Frequently asked questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1790308570460-0\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><span class=\"ez-toc-section\" id=\"Does_hreflang_improve_a_sites_rankings_in_Google\"><\/span>Does hreflang improve a site&#8217;s rankings in Google?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>No, hreflang is not meant to improve rankings. It helps Google show the user the right language version of the same content. Thanks to this, the visitor lands straight on the page in their own language.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1790308570460-1\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><span class=\"ez-toc-section\" id=\"Do_I_have_to_use_x-default\"><\/span>Do I have to use x-default?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>X-default is not mandatory. But if you have a language selection page or a homepage with an automatic redirect, add it. Users whose language you do not support will then land on the fallback page.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1790308570460-2\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><span class=\"ez-toc-section\" id=\"Is_the_lang_attribute_in_the_html_tag_enough\"><\/span>Is the lang attribute in the html tag enough?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>No, it is not enough. Google does not use the lang attribute either to indicate language versions or to recognize the language of a page. To connect the equivalents, you need hreflang in the head section, in the HTTP header or in the sitemap.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Hreflang is an annotation that tells Google that several URLs are language versions of the same content. Based on it, the search engine decides which URL to show to a user from a given language or country. Sound familiar? A customer from Germany types in your company name and lands on the Polish page instead [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":30183,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[822],"tags":[972,1081,2229,2243,2241,1246],"class_list":["post-30205","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-seo-sem-en","tag-google-en","tag-how-to","tag-hreflang-x","tag-language-versions","tag-multilingual-website","tag-seo-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/posts\/30205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/comments?post=30205"}],"version-history":[{"count":3,"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/posts\/30205\/revisions"}],"predecessor-version":[{"id":30254,"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/posts\/30205\/revisions\/30254"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/media\/30183"}],"wp:attachment":[{"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/media?parent=30205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/categories?post=30205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.web-systems.pl\/en\/wp-json\/wp\/v2\/tags?post=30205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}