Website monitoring · No. 17

Canonical and hreflang check

Chebotar A. · CEO FullCheckApp Updated 8 min read

In short

Canonical is a tag a page uses to tell search engines which address is its main one. For a regular page, it should point to the page itself. Hreflang is markup that links the language and regional versions of a page so that Google shows people the version in their language. Both break silently: after an update the canonical starts pointing to another page, a non-existent language code like “ua” appears in hreflang, a language version stops linking back. Then Google ignores the markup, and the wrong version of the page shows up in search.

Contents
  1. What are canonical and hreflang?
  2. What’s the harm in canonical and hreflang mistakes?
  3. Why do canonical and hreflang break?
  4. How do you spot a canonical or hreflang problem?
  5. How to check canonical and hreflang yourself
  6. What FullCheckApp checks
  7. FAQ
  8. Sources

What are canonical and hreflang?

Canonical is the <link rel="canonical" href="…"> tag in the page code. It tells Google which address to treat as the main one if the same page can be opened at several addresses. For a regular page, the canonical points to the page itself — Google recommends exactly that:

“Do include a rel="canonical" link on the canonical page itself (also known as a self-referential canonical).”
— Google Search Central, How to specify a canonical with rel="canonical" and other methods

Hreflang is the set of <link rel="alternate" hreflang="…" href="…"> tags that list the language and regional versions of a page. Google uses them to show a person the version in their language or for their country (Google documentation).

An hreflang code consists of a language code and, optionally, a country code. This is where mistakes happen most:

What was meantCorrectMistake
Ukrainianuk or uk-UAua — a country code, not a language code
English for the United Kingdomen-GBen-UK — there’s no such country code
A version for all other languagesx-default—

What’s the harm in canonical and hreflang mistakes?

A canonical pointing to another page tells Google: this page is a copy, show the other one. A category page with a canonical to the home page, or a product with a canonical to another model, may drop out of search even though nobody blocked it. At the same time, canonical is only a hint: “indicating a canonical preference is a hint, not a rule” (Google documentation), so the outcome of the mistake is unpredictable.

Hreflang only works when all versions agree with each other:

“Each language version must list itself as well as all other language versions.” […] “If two pages don’t both point to each other, the tags will be ignored.”
— Google Search Central, Tell Google about localized versions of your page
  • The wrong language in search. If hreflang is ignored, a person in Poland may get the Ukrainian version, and a person in Ukraine the Russian one.
  • A broken version in the pair. A language version returns 404, is blocked with noindex or has a canonical to another address — and the pair doesn’t work.
  • Nobody sees the mistake. The site works, the language switcher works. Search Console no longer has a separate report on hreflang errors, so the problem is noticed from falling traffic from other countries.

Why do canonical and hreflang break?

Mostly because of templates and plugins:

  • Canonical from a template. The theme outputs a canonical to the home page on every page, or to the first category page on every pagination page.
  • Copied pages. A new page was created as a copy of an old one, canonical included.
  • Wrong language codes. Someone entered ua instead of uk or en-UK instead of en-GB in the translation plugin settings.
  • A deleted or moved version. A language version moved to another address, but hreflang on the other versions wasn’t updated.
  • Different markup on different versions. One language version was updated and the others weren’t, so they stopped linking to each other.
  • A duplicate code. The same language code is listed twice with different addresses.

How do you spot a canonical or hreflang problem?

The signs are in the page code and in search:

What you seeLikely causeWhat to do
The canonical points to another addressA template or a copied pagePoint the canonical to the page itself
The page has no canonicalThe theme or plugin doesn’t output itAdd a self-referencing canonical
hreflang contains ua or en-UKA wrong language or country codeReplace it with uk / en-GB
The page doesn’t list itself in hreflangThe plugin lists only the other versionsAdd an hreflang line with the page’s own address
A language version doesn’t link backThe versions were updated separatelyAlign hreflang on all versions
Search shows the wrong language versionhreflang was ignoredCheck the codes, return links and canonical of all versions

How to check canonical and hreflang yourself

You’ll need a browser and some attention to detail:

  1. Open the page source (Ctrl+U) and find rel="canonical". The address should match the page’s address.
  2. Find all hreflang lines. Check the codes: the language is two letters (uk, en), the country comes after a hyphen (uk-UA, en-GB). The page itself should be among the versions.
  3. Open each language version: it should open, not be blocked with noindex, have a canonical to itself and link back to your page in hreflang.
  4. Make sure each code appears only once.
  5. Or use the FullCheckApp “Canonical and hreflang” check and get the results in a clear visual format.

For a site in five languages, that’s dozens of clicks per page — and they should be repeated after every update.

If you chose the last option, you’ve already made the right call: the check runs automatically, and you’ll be the first to know about any warning or critical issue.

What FullCheckApp checks

“Canonical and hreflang” is one of the four checks in the SEO block. It works for the home page and the pages added to monitoring. The default severity is a warning.

  • Canonical. The tag is present and points to the same page.
  • Language and country codes. The codes are correct; common mistakes get a hint: ua → uk, en-UK → en-GB.
  • One code, one address. The same code isn’t listed twice with different addresses.
  • A link to itself. The page is in its own list of versions.
  • Return links. FullCheckApp opens and checks each language version on the site’s domain: it works, isn’t blocked from indexing and links back. Versions on other domains aren’t checked.
SEO · Canonical and hreflangexample.com/uk/ · example
Canonicalmatches the pagehttps://example.com/uk/
Hreflang5 versions · 2 problemsuk, en-GB, pl, de, x-default

ua — there’s no such language code; Ukrainian is uk (or uk-UA)

de · https://example.com/de/ — no return link to /uk/

Whether the page itself is blocked from indexing is shown by the noindex and nofollow check, and whether it opens at several addresses — by the duplicate URL check.

FAQ

Should the canonical always point to the page itself?

For pages that should be in search — yes. A canonical to another address is set on purpose for copies: sorting and filter pages, versions with parameters. But such pages are usually not added to monitoring. If a canonical to another address appears on the home page, a category or a product page, it’s most often a template error.

Why is “ua” a mistake if everyone writes it?

In hreflang, the language comes first, per ISO 639-1, and Ukrainian is “uk” there. UA is the country code for Ukraine per ISO 3166-1, and it can only come second: uk-UA. Google doesn’t recognize “ua” as a language, so such an hreflang line doesn’t work.

What is a return link in hreflang?

It’s the hreflang line on a language version that points back to your page. If the Ukrainian page links to the English one, the English one must link to the Ukrainian one too. Google says that if two pages don’t both point to each other, the tags are ignored.

Do I need x-default?

It’s not required, but Google recommends it for language or country selector pages and for home pages that automatically redirect visitors. x-default shows which version to open for people whose language has no version of its own.

Why aren’t versions on other domains checked?

FullCheckApp checks the site you added and doesn’t open other domains without your knowledge. If your language versions live on separate domains, add them to monitoring as separate sites — then their markup will be checked too.

Sources

  1. Google Search Central — How to specify a canonical with rel="canonical" and other methodsdevelopers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls
  2. Google Search Central — What is URL canonicalizationdevelopers.google.com/search/docs/crawling-indexing/canonicalization
  3. Google Search Central — Tell Google about localized versions of your pagedevelopers.google.com/search/docs/specialty/international/localized-versions

Check your website

Add your website address — the first check runs right away, and you’ll see the status of every item in this article.

Check for free

Related articles

15 Page SEO tags checkWhat a search engine sees on a page: title and description length, the H1 heading, noindex, canonical, hreflang and Open Graph tags for social media. 19 Duplicate URL checkWhy one page opens at several addresses — with and without www, over http and https, as /index.php or with a trailing slash — and why a redirect fixes it, not a canonical tag. 16 Noindex and nofollow checkHow a single noindex line in a meta tag or server response header removes a page from Google, where it comes from after work on the site, and how to catch it in time.