What is hreflang, and when does your site need it?
The Tasadr team · ·3 min read
hreflang tells Google that pages on your site are versions of one piece of content in different languages or for different countries, such as an Arabic version for Saudi Arabia, one for Egypt and one in English. Each version must point to the others, and Google then shows each visitor the best fit.
Also known as hreflang · hreflang tag · rel=alternate hreflang · language and region tags · هرفلانج · وسم اللغة
On this page (7)
What is hreflang?
It is an annotation you place on a page to tell Google that the page has other versions in other languages or for other countries, and to list their addresses. Google then shows each user the version closest to their language or country.
Google does not use it to detect a page's language. It uses it to link versions. The language follows ISO 639-1 and the optional region follows ISO 3166-1, so Arabic for Saudi Arabia is ar-SA, for the UAE ar-AE and for Egypt ar-EG. You cannot write a country code on its own.
Which hreflang rules do most sites break?
The first rule is that pages point to each other. If the Arabic page points to the English page and the English page does not point back, Google ignores the tag. The second is that each version lists itself along with the others, and the third is that the values carry valid codes. For a visitor whose language matches no version, use the x-default value.
Google's hreflang rules Rule What is needed Example Return links Each version points to the others Arabic points to English and back Self-reference Each version lists itself The ar-SA version lists its own address Codes A language, then an optional region ar-EG, not EG alone Fallback x-default for visitors no version fits A country selector page An Arab-market example: a travel company with versions for three markets
An illustrative example. A fictional travel company at gulf-travel.example has a packages page in three versions: Arabic for Saudi Arabia, Arabic for Egypt, and English for everyone. The packages and prices differ.
In each version it places a list of annotations naming all three and itself, ar-SA, ar-EG and en, and adds x-default for a page where visitors choose their country. An Egyptian traveller is then less likely to meet the Saudi packages in a search result. That is a preference Google weighs, not a promise.
What steps should you take to write hreflang correctly?
Pick one method that is easy to maintain. The three are equivalent to Google. What matters is that the signals are correct and reciprocal.
- Place link elements in the head, or in an HTTP header, or in the sitemap: one of them, not all three.
- Make each version list itself and every other version.
- Use valid codes such as ar-SA, ar-AE and ar-EG.
- Add x-default for a country or language selector page.
- Do not machine-translate pages without review, as in machine-translated pages.
Sources
- Tell Google about localized versions of your page · Google Search Central ·
Frequently asked questions
Why does Google ignore my hreflang?
Do I write ar or ar-SA for the Arabic page?
Do AI engines need hreflang?
Try Tasadr free for 7 days
Add your site, write up to 10 questions your customers ask, and see who leads the answer today. No credit card needed.
Start your free trial