Document does not have a valid rel=canonical

Updated

When multiple pages have similar content, search engines consider them duplicate versions of the same page. For example, desktop and mobile versions of a product page are often considered duplicates.

Search engines select one of the pages as the canonical, or primary, version and crawl that one more. Valid canonical links let you tell search engines which version of a page to crawl and display to users in search results.

Key Term: Crawling is how a search engine updates its index of content on the web.

Using canonical links has many advantages:

  • It helps search engines consolidate multiple URLs into a single, preferred URL. For example, if other sites put query parameters on the ends of links to your page, search engines consolidate those URLs to your preferred version.
  • It simplifies tracking methods. Tracking one URL is easier than tracking many.
  • It improves the page ranking of syndicated content by consolidating the syndicated links to your original content back to your preferred URL.

Lighthouse flags any page with an invalid canonical link:

Lighthouse audit showing document with invalid canonical link

A page fails this audit if any of the following conditions are met:

  • There is more than one canonical link.
  • The canonical link is not a valid URL.
  • The canonical link points to a page for a different region or language.
  • The canonical link points to a different domain.
  • The canonical link points to the site root. Note that this scenario may be valid in some scenarios, such as for AMP or mobile page variations, but Lighthouse nonetheless treats it as a failure.

Each SEO audit is weighted equally in the Lighthouse SEO Score, except for the manual Structured data is valid audit. Learn more in the Lighthouse Scoring Guide.

There are two options for specifying a canonical link.

Option 1: Add a <link rel=canonical> element to the <head> of the page:

<!doctype html>
<html lang="en">
<head>

<link rel="canonical" href="https://example.com"/>

</head>
<body>

</body>
</html>

Option 2: Add a Link header to the HTTP response:

Link: https://example.com; rel=canonical

For a list of the pros and cons of each approach, see Google's Consolidate duplicate URLs page.

General guidelines

  • Make sure that the canonical URL is valid.
  • Use secure HTTPS canonical URLs rather than HTTP whenever possible.
  • If you use hreflang links to serve different versions of a page depending on a user's language or country, make sure that the canonical URL points to the proper page for that respective language or country.
  • Don't point the canonical URL to a different domain. Yahoo and Bing don't allow this.
  • Don't point lower-level pages to the site's root page unless their content is the same.

Google-specific guidelines

  • Use the Google Search Console to see which URLs Google considers canonical or duplicative across your entire site.
  • Don't use Google's URL removal tool for canonization. It removes all versions of a URL from search.

Recommendations for other search engines are welcome. Edit this page.

Resources

Last updated: Improve article