Anticode Open builder

What is a canonical tag, and when does a page need one?

A canonical tag is a line in a page's head, <link rel="canonical" href="…">, naming the one URL you want search engines to treat as the original when the same content is reachable at several addresses. It's a strong hint, not an order, and pointing it at the wrong URL is one of the quickest ways to make a page vanish from results.

Updated · By the Anticode team

The problem it solves

To see what is a canonical tag for, start with the problem. One page often answers at several addresses without anyone meaning it to: https://example.com/shoes, the same with www, with a trailing slash, with ?utm_source=newsletter, or with ?sort=price. To a search engine these are separate URLs with identical content. It will pick one to show and fold the others into it. Usually it chooses well; a canonical tag lets you state your preference so links and signals gather on the address you want, and so the version in results is the clean one.

How it's written

The tag goes in the <head>: <link rel="canonical" href="https://www.example.com/shoes">. Use a full absolute URL with https://, the exact host you use and no fragment. Google's canonical URL guide recommends absolute URLs and a self-referencing canonical on the preferred page itself. For files that have no head, such as PDFs, the same thing can be sent as an HTTP Link header. The underlying standard is RFC 6596.

Canonical, redirect or noindex?

Three ways to deal with duplicate URLs
ToolVisitorsSearch enginesUse when
301 redirectSent to the new URLStrong signal to replace the old URLThe old address shouldn't exist any more
Canonical tagStay on the URL they openedStrong hint to index the canonical insteadBoth addresses must keep working, such as tracking or sort parameters
noindexStay on the pageRemove the page from resultsThe page shouldn't be in search at all, never to pick between duplicates

If a URL has simply moved, a 301 redirect is the stronger and clearer choice. A canonical is for duplicates that need to stay reachable.

Does your site need canonical tags?

  1. Check which host answers. Open both example.com and www.example.com. If both load the same site without redirecting, fix that first with a redirect, since it duplicates every page.
  2. Look for parameters. Do links from campaigns, filters or sorting add ? to your URLs? If those pages are crawlable, a self-referencing canonical on each base page keeps the clean URL in results.
  3. Look for copies. The same article syndicated on another site, or printed versions, are candidates for a canonical pointing at the original.
  4. Check what Google chose. Search Console's URL Inspection shows the user-declared canonical and the Google-selected canonical. If they differ, read on.
  5. If none of this applies, a small site with one host and clean URLs doesn't strictly need canonical tags. A self-referencing one does no harm.

Mistakes that drop pages from the index

  • Every page canonicalised to the home page. Often copied from a template. Google is then told the whole site is one page.
  • Canonicals pointing at http:// or a staging host. The page names an address that redirects or doesn't exist.
  • Conflicting signals: the sitemap lists one URL, the canonical names another and internal links use a third.
  • A canonical on a page that's also noindex. The two say opposite things.
  • Adding the tag with JavaScript after load. Put it in the HTML the server sends.
  • Canonicalising translations to the English page. Different languages aren't duplicates; they need hreflang, not a canonical to one version.

When Google picks a different canonical

The Page indexing report labels this "Duplicate, Google chose different canonical than user". It means Google weighed your tag against other signals and disagreed. Usual causes: the two pages aren't really duplicates, internal links mostly point at the other one, or the URL you named redirects or returns an error. Make the signals agree (links, sitemap, canonical and redirects all naming one URL) and it usually settles after the next crawl.

On Anticode sites

Anticode's design-engine pages don't include a canonical tag, and the code editor doesn't let you add one. Collection pages served from the CMS do carry one, pointing at their own address. For a typical Anticode site that's rarely a problem: each published site serves its own sitemap.xml listing its pages, and you choose a single address. The thing to get right is the host. If you connect a custom domain, pick www or the bare name and set the other to redirect at your DNS provider if it offers forwarding, because Anticode doesn't redirect between them. Campaign links with UTM parameters will reach the same page, and Google normally folds them in.

Questions people ask

Should a canonical tag point to the page itself?

Yes, on the preferred version. A self-referencing canonical confirms which URL you want even if someone links to it with parameters.

Can a canonical point to another domain?

Yes, for content republished elsewhere. The copy names the original's URL, and search engines may then show the original.

Do UTM parameters need canonical tags?

A self-referencing canonical on the base page helps. Google usually handles tracking parameters well, but the tag removes any doubt.

Sources

  1. How to specify a canonical URL (Google Search Central), checked
  2. RFC 6596: The Canonical Link Relation, checked