Why it matters
- hreflang says what a version is for (here, Saudi Arabia in Arabic);
langsays what its text is written in. When they disagree, one of them is wrong, and search engines, browsers and screen readers get two answers for one page. - The common cause in a store is a copied template: the Emirates store was made from the Saudi one, and the head kept
lang="ar-SA"or the links kept the first country's code. langdecides how screen readers pronounce the text and which fonts and quotes a browser picks; hreflang decides which version people in each country are shown.
Example
<html lang="ar-AE" dir="rtl">
<html lang="ar-SA" dir="rtl">
How to fix
Make the code the page lists itself with and its <html lang> agree:
html
<html lang="ar-SA" dir="rtl">- If the page is for Saudi Arabia, both say
ar-SA(orlang="ar"withhreflang="ar-SA": alangwithout a region fits any country). - If the text is in another language than the list says, fix the list: the version for that language is another page.
- In a store builder, set the language and the country of each market, and check the theme prints
langfrom the market's language.
How we detect
- We find the page's own entry among its hreflang links, by its canonical address (see the rule about the set of links); when the scan cannot tell which entry the page is, it does not judge.
- We compare its language subtag with the language subtag of
<html lang>, and, when both give a region, the regions. Alangwithout a region matches any region.