How hreflang works
When you publish the same page for more than one audience — an Australian version and a UK version of a service page, or an English and a Nepali version of the same guide — search engines have to decide which one to show a given searcher. Hreflang is the annotation that answers that. Each version declares its own language, optionally a country, and the addresses of every other version, using standard language and region codes such as en, en-au, en-gb or ne-np.
You can supply the annotation in three places: link elements in the head of each page, HTTP headers for files like PDFs, or entries inside your XML sitemap. The sitemap method scales best for a large site because the whole set lives in one file. Whichever you pick, use one method only — mixing them multiplies the places a mistake can hide. There is also a special value, x-default, for the version that should be served when no other one fits.
Why hreflang matters
Its real job is preventing the wrong page from winning. Without it, an Australian and a British page that say almost the same thing look like near-duplicates, and search engines pick one to show everybody. The result is a searcher in Sydney landing on a page quoting British prices, phone numbers and delivery terms, then leaving. Hreflang does not rank a page higher; it makes sure the ranking a page already earned is spent on the right visitor.
It also protects the effort you have put into localised pages. If you have written genuinely different content for different markets, hreflang is what stops that work collapsing into a single version that serves nobody properly — which is why it sits at the centre of any international SEO setup.
Where hreflang goes wrong
Almost every failure is a broken pair. The annotation must be reciprocal: if the Australian page points at the British page, the British page must point back. A one-way declaration is ignored, silently, with no error anywhere on the site itself.
The other frequent faults are mechanical. Country codes are used where a language code was meant, so a page declares uk instead of gb, which is not a valid country code. URLs in the annotation are relative or point at a redirect instead of the final address. Or the annotation fights the canonical tag, because every version canonicalises to the English one, which tells search engines the other versions should not exist at all. And hreflang cannot rescue pages that are identical apart from a currency symbol; if two versions have nothing different to say, they should be one page.
How to get it right
Build the set of versions as a list before you touch any code, then generate the annotations from that list rather than editing pages by hand. Every version, including the page itself, appears in every version’s set, so the group is symmetrical by construction. Use absolute URLs, point them at the address that actually returns the page, and declare x-default once for the fallback.
Then verify rather than assume. Search Console reports hreflang problems under its international targeting signals, and a crawler will list pages whose return links are missing. Re-check after any migration, because changed URLs break every pair at once and the symptom — the wrong country’s page ranking — takes weeks to notice on its own.
