Skip to main content
Legia

SEO & Digital Marketing

What is Hreflang?

Also called rel alternate hreflang, language tag, hreflang annotation.

Short definition

Hreflang is an attribute that tells search engines a page has other versions for different languages or regions, so searchers are directed to the version that matches their language.

How to implement it

There are three ways: a link element in the page's head section, an HTTP header for files such as PDFs, or entries in an XML sitemap. Language codes follow the ISO format, for example id for Indonesian and en for English, and can be combined with a region code such as en-SG. The x-default value marks the fallback page for users whose language is not listed.

The rules most often broken

Every version must list all the other versions, including itself. If the Indonesian page points to the English page, the English page must point back; without the return link, the annotations may be ignored. The URLs listed must be complete, accessible, and canonical, not redirected addresses.

Example in a company

A company that serves local clients and overseas partners publishes its website in Indonesian and English. Without hreflang, English-speaking searchers may land on the Indonesian page, or the two versions compete in the same results. Hreflang does not translate anything and is no substitute for good translation; it only connects existing versions so each searcher finds the right one. Once it is in place, the reports and testing tools in Search Console help find missing return links or incorrect language codes.

Related Legia service SEO Technical fixes, content structure, and local search, measured through to incoming inquiries.