Lesson 3 of 14
rel="canonical" tells search engines which URL is the real one when several serve near-identical content; rel="alternate" hreflang tells them which URL to show which language/region audience. They solve adjacent problems, and mixing up the rules between them is one of the most common ways international sites quietly lose search visibility.
13 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
This topic is about judgment and practical tradeoffs more than a single right answer — a mock interview is the better way to test yourself on it.
Be interviewed on this →Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
<link rel="canonical" href="..."> answers one question: when multiple URLs serve the same or near-duplicate content — ?sort=price query params, http vs https, trailing slash vs not, a print-friendly version — which single URL should search engines treat as the authoritative one to index and rank? Every ranking signal (links, engagement) pointed at the duplicates gets consolidated onto the canonical target instead of being split across near-identical pages competing with each other.
<link rel="alternate" hreflang="..."> answers a completely different question: when the same content exists in multiple languages or region variants at different URLs (/en/pricing, /fr/pricing, /en-gb/pricing), which URL should be shown to a searcher in which language/region? It's not about picking one canonical winner — every language variant is legitimate and should rank for its own audience; hreflang just tells Google which one to serve to whom.
Both live as <link> tags in <head> (or as HTTP headers, or in a sitemap for hreflang at scale), and both are hints Google weighs rather than absolute commands — but a broken implementation of either one reliably costs visibility, which is why interviewers who've actually shipped international sites probe here.
<!-- On https://example.com/en/pricing -->
<link rel="canonical" href="https://example.com/en/pricing" />
<link rel="alternate" hreflang="en" href="https://example.com/en/pricing" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/pricing" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/pricing" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/pricing" />
Every one of those hreflang tags — including the one for the page's own language — must appear on every page in the set, pointing at every other page in the set (including each other), and each of those target pages must, in turn, link back to this one. That reciprocity is called the return tag requirement: Google explicitly ignores an hreflang annotation if the page it points to doesn't link back with a matching one. x-default is the fallback shown to a searcher whose language/region doesn't match any variant you've declared — commonly pointed at a language-selector page or the primary/English version.
/fr/pricing's canonical at /en/pricing tells Google the French page is just a duplicate to be dropped, which silently removes it from ranking for French searchers entirely. In an internationalized setup, canonical is almost always self-referencing on every language variant, not pointed at one "main" version./en/pricing claims /fr/pricing as its French alternate but /fr/pricing doesn't link back, the relationship doesn't count, even though half of it is correctly authored.x-default isn't "the English version" — it's a fallback for traffic that doesn't match any declared hreflang variant, and is commonly best pointed at a language-selection page rather than assumed to be interchangeable with en.Canonical tags come up constantly in generic SEO screening, but hreflang is where an interviewer at a company with real international traffic will actually probe depth — because the failure modes are specific and diagnosable: "what happens if a return tag is missing," "what's the difference between canonical and hreflang when they seem to overlap," "why would a French page vanish from French search results." Being able to explain the return-tag requirement and the same-language canonical rule by name, rather than gesturing at "SEO stuff for other countries," is the actual signal being tested for.