How to configure the multilingual website hreflang? The most error-prone aspect is not the code, but the language, region, and URL correspondence topic visuals

How to configure the multilingual website hreflang? The most error-prone aspect is not the code itself, but the correspondence between language, region and URL

Author: JVDS Design Studio Reading time: about 8 min

The code of hreflang is only one line. The truly complex part is: which URL corresponds to which language and region, whether the pages declare each other, who the default page is, and whether the canonical is consistent. When there is a configuration error, the tags may be directly ignored.

01 First, figure out what problem hreflang solves

If a website is available in Chinese, English, Japanese, or the same language corresponds to different country versions, the search system needs to know that these URLs are localized versions of the same content and which one is more suitable for a certain type of user. hreflang is the signal used to express this relationship.

Google's current multilingual documentation clearly states that even without configuration, it may still discover pages in different languages. However, it is best for a site to explicitly label the language or regional version, so that search results have a greater chance of displaying the appropriate URL to the corresponding user.

02 Do not confuse language with region

"en" stands for English and is not limited by country. "en-US" represents English for the United States. "en-GB" is British English. Chinese can also be written in script forms such as zh-Hans and zh-Hant, or combined with regions. The most common mistakes made by enterprises are treating countries as languages, using self-made codes, or overly segmenting regions when there are only language differences.

Whether a regional version is needed depends on whether the content is really different. Only when the currency, regulations, products, distribution or market content are significantly different can there be more reasons to distinguish en-US, en-GB, etc. If the page content is exactly the same but ten country URLs are generated, it will significantly increase the maintenance cost.

Each language page should list its own and other versions of visual descriptions

03 Each language page should list itself and other versions

Google's hreflang guidelines require each language version to list itself while also listing other language versions. These pages also need to refer to each other in both directions. If A declares that B is in English but B does not declare A back, this relationship may be ignored.

This is also the most error-prone area for large multilingual websites: after adding a new language, only tags are added to the new page, while the old version template is not updated synchronously. The most reliable approach is to generate it by CMS or a unified template rather than maintaining it page by page manually.

04 One of the three methods - HTML, HTTP Header, and Sitemap - is sufficient

Google's current documentation provides three equivalent methods: adding link rel="alternate" hreflang in the HTML head, through HTTP Header, or declaring in the XML Sitemap. There is no need to implement three sets of search angles simultaneously.

The most commonly used HTML or Sitemap for ordinary corporate websites. The more methods there are, the stronger the signal is not necessarily. On the contrary, it may increase the difficulty of troubleshooting due to the inconsistency of the three sets of data.

x-default is used to handle visual descriptions for users who do not have a matching language

05 x-default is used to handle users without a matching language

Google suggests using hreflang="x-default" to point to the default version or language selection page. When the user's language is not in an existing version, x-default provides an explicit fallback.

For example, if a website only has English, Japanese and Simplified Chinese, you can set the international English homepage or the country/language selection page as x-default. It is not another way of writing "English", but the default URL in the case of mismatch.

06 hreflang and canonical should not fight each other

Each localized page should usually be canonical to itself, rather than all languages being canonical to the English homepage. If a Chinese page is canonical to an English page but then claims through hreflang that they are different language versions, it will send contradictory signals to the search system.

When making a revamp, it is also necessary to simultaneously check whether the final URLs of 301, canonical, and hreflang are consistent. Do not let hreflang point to an old address that has already been redirected.

Forced redirection based on IP addresses is often not a visual representation of the best user experience

07 Automatically forcing redirection based on IP is often not the best user experience

Just because a user is in Japan doesn't mean they necessarily want to read Japanese. Overseas Chinese may need Chinese. VPNS and enterprise networks can also change IP addresses. A more reliable approach is usually to provide suggestions based on the browser language or region, while retaining obvious language switching and remembering the user's choices.

For search crawling, forced redirection may also make it difficult for web crawlers to access other versions. Internationalization should enable users to switch actively instead of completely locking language selection.

08 After going live, sampling verification should be conducted instead of merely focusing on the success of code generation

Large websites are best to regularly sample and check different templates: homepages, products, articles, categories, and special pages, to confirm whether the hreflang collection is complete, two-way, the URL is accessible, and the status code is correct. It is also necessary to avoid forcibly directing pages that do not have translations to the homepage.

If a certain page does not have a corresponding language version, it is not necessary to declare that version. Google's 2023 statement on x-default also clearly states that it is not required that every page of a website have all localized versions.

09 Conclusion: hreflang is content relationship management, not SEO magic tags

hreflang does not automatically push low-quality pages to the homepage. It addresses the issue of "which localized URL is more suitable for which user". Therefore, the most important thing is to first clearly design the website language and regional strategy, and then automatically generate stable and consistent tags.

If the team doesn't even have a unified answer to questions like "Is this page in International English or American English?" or "Where should one go when there is no Chinese version?", first solve the content and URL rules, and then write the code.

Frequently Asked Questions

Do only Chinese and English websites need hreflang?

Recommended for use. It can clearly tell Google that the two URLs are localized versions in different languages.

Can hreflang be written only on the English page?

Not recommended. Google requires that localized pages form mutual declarations and include self-references.

What does "x-default" mean?

It represents the default URL used when there are no other language or region matches, and is often used on international default pages or language selection pages.

Do both HTML and Sitemap need to be configured with hreflang?

No need. Google considers HTML, HTTP Header and Sitemap to be equivalent, and it is sufficient to choose the one that is easiest to maintain stably.

Can all language pages be canonical to the English page?

This should not usually be done. Independent localized pages usually need to be self-canonical and express their interrelationships using hreflang.

Related ServiceLearn More
Corporate Website Design ServicesView Service Details
Project ConsultationContact JVDS Design Studio
Design and Website Development ArticlesRead More Related Articles
Link copied

From Idea to Launch, We Build It Together

Building useful, scalable digital products around user experience

Tell Us About Your Project