Canonical URLs: A Beginner's Guide to Canonical Tags

Aug 05, 2024 06:45 PM - 4 months ago 99712

What Is a Canonical URL?

A canonical URL is nan type of a webpage chosen by hunt engines for illustration Google arsenic nan main type erstwhile location are duplicates. And is prioritized to debar showing repetitive contented that doesn’t supply unsocial worth successful hunt results.

Consider these 2 URLs:

  • Canonical URL: https://example.com/blog/
  • Non-canonical (alternate) URL: https://example.com/blog/?page=1

In this example, Google will apt take nan canonical URL for indexing and ranking. 

The canonical page tin besides beryllium called nan “principal,” “primary,” aliases “representative” version.

What Is a Canonical Tag?

A canonical tag (also known arsenic nan rel="canonical" tag) is simply a snippet of HTML codification that allows you to specify nan superior type successful a group of copy aliases near-duplicate pages connected your site.

In SEO, canonical tags propose to Google which type of nan page it should index, consolidate nexus equity (ranking strength) to, and show successful hunt results.

Canonical tags are recovered successful nan <head> conception of a webpage’s HTML root codification and look for illustration this:

<link rel="canonical" href="https://example.com/preferred-url-here/" />

Here’s really that useful successful believe connected 1 of nan alternate pages:

split surface showing an article and its HTML code, highlighting "Alternate URL" and "Canonical Tag" pinch arrows

Typically, canonical tags constituent from an alternate page to nan preferred page.

an illustration of canonical tag pointing from an alternate page to a preferred one

But it’s besides a bully thought to usage self-referencing canonicals. 

In different words, each canonical page should person a canonical tag that points to its ain URL.

Like this:

split surface of an article and developer devices displaying HTML codification highlighting a self-referencing canonical link

Google’s John Mueller confirmed nan value of self-referencing canonicals successful a Google Search Central hangout.

Canonical tags are a valuable deduplication tool. They tin resoluteness issues pinch duplicate content (or near-identical pages) you request to keep.

For example: 

  • American English and British English versions of nan aforesaid page
  • Parameterized URLs (e.g., listing pages pinch filters aliases sorting options applied)

Why debar copy content?

Because it tin origin keyword cannibalization. This occurs erstwhile aggregate pages connected a tract compete for nan aforesaid keywords. And harm each other’s rankings successful nan process. 

infographic divided into 3 vertical sections, each representing a antagonistic effect of copy contented connected SEO

Using canonical tags correctly helps Google understand your site’s structure. And place nan champion type of a duplicated page.

This helps guarantee nan type you want is nan 1 shown successful hunt results (and nan 1 searchers access). Which tin lead to higher click-through and conversion rates.

Plus, Google consolidates nan ranking powerfulness of alternate pages to canonical URLs.

Let’s opportunity you person backlinks (links from outer domains) pointing to various copy pages. If you’ve utilized canonical tags, Google treats them each arsenic links to that main URL. To positively effect rankings. 

an illustration of backlinks, alternate URLs and canonical URLs connection

How to Implement Canonical Tags

To instrumentality canonical tags successful your HTML, you tin adhd nan rel="canonical" tag to nan <head> conception of nan page. 

As a reminder, that looks thing for illustration this:

<link rel="canonical" href="https://example.com/preferred-url-here/" />

But nan nonstop measurement to instrumentality them is simply a spot different depending connected your platform. Let’s spell complete 5 of nan astir common:

Magento 1

If you’re moving a Magento 1 store, travel these steps to specify canonical URLs for merchandise and class pages.

Product Page Canonicals

Log successful to your admin panel, past caput to “System” > “Configuration.” 

Click “Catalog” and unfastened nan “Search Engine Optimizations” section.

where to specify canonical URLs for merchandise and class pages successful Magento 1

If it isn’t already, group nan “Use Canonical Link Meta Tag For Products” section to “Yes.”

set nan “Use Canonical Link Meta Tag For Products” section to “Yes”

Category Canonicals

Head backmost to nan “Search Engine Optimizations” conception connected nan “Catalog” page.

Find nan “Use Canonical Link Meta Tag For Categories” action and make judge it’s group to “No.”

set nan “Use Canonical Link Meta Tag For Categories” action to "No"

Now, you tin manually specify nan canonical URL for categories.

Head to nan edit page of immoderate class you want to canonicalize and find nan “Custom Design” tab.

In nan “Custom Layout Update” box, adhd nan pursuing codification (making judge to switch successful your canonical URL).

<reference name="head">
<action method="addLinkRel">
<rel>canonical</rel>
<href>https://example.com/preferred-url-here/</href>
</action>
</reference>

“Custom Layout Update” container successful Magento 1

Magento 2

If you’re moving a Magento 2 store, travel these steps to specify canonical URLs crossed your site.

Log successful to your admin panel, past spell to “Stores” > “Settings” > “Configuration.”

Next, unfastened “Catalog” > “Catalog” and spell to nan “Search Engine Optimization” section.

“Search Engine Optimization” conception successful Magento 2

Image Source: Amasty

Set “Use Canonical Meta Tags For Categories” to “Yes.” So Magento will automatically adhd canonical tags to alternate class pages.

The default config way is “catalog/seo/category_canonical_tag.”

Also group “Use Canonical Meta Tags For Products” to “Yes.” So Magento will automatically adhd canonical tags to alternate merchandise pages.

The default config way is “catalog/seo/product_canonical_tag.”

Shopify

Shopify automatically handles canonical tags for merchandise pages, collections, and blog posts.

This built-in strategy useful good for astir setups. Like if:

  • Your products person variants (like different colors aliases sizes)
  • You usage pagination aliases filtering connected postulation pages
  • You person modular blog posts

If your tract is much analyzable and requires immoderate further activity to instrumentality canonical tags, you tin adhd them manually.

Go to your Shopify admin, prime “Themes” from nan paper to nan left, and click “Actions” > “Edit Code.”

Shopify interface showing nan "Themes" section, pinch a dropdown paper highlighting nan "Edit code" option

In nan near sidebar, click connected nan record you want to edit. If you’re implementing thing that will use crossed your site, you’d take “theme.liquid.” 

Shopify interface showing codification editor pinch "theme.liquid" record unfastened and HTML codification displayed

From here, you’ll request to edit nan codification utilizing nan due metafield (a section you tin usage for customization). This requires a adjacent magnitude of method know-how, truthful you whitethorn want to activity pinch a developer. 

There are besides respective Shopify apps disposable to adhd canonical tags. 

Canonical Tag URL Wizard is simply a celebrated choice. Because it enables you to negociate canonical tags without diving into code.

WordPress

You tin group canonical URLs connected your WordPress tract by utilizing a WordPress SEO plugin. 

We’ll look astatine really to do this pinch 2 of nan astir celebrated plugins: Yoast SEO and Rank Math SEO.

Yoast SEO Plugin

If you’re utilizing nan Yoast SEO plugin, caput to nan Yoast SEO options connected immoderate page aliases post. 

Then, grow nan “Advanced” tab. 

You’ll find a “Canonical URL” section wherever you tin specify nan page’s canonical URL.

“Advanced” tab successful Yoast SEO options

Rank Math SEO Plugin

If you’re utilizing nan Rank Math SEO plugin, caput to nan “Rank Math SEO” container connected immoderate page aliases post. And unfastened nan “Advanced” tab.

The “Canonical URL” section allows you to specify nan canonical URL for nan page.

“Advanced” tab successful “Rank Math SEO” box

Wix

Wix pages usage a self-referencing canonical tag by default.

You tin alteration nan building of your canonical tags by going into your SEO settings.

First, caput to “Site & Mobile App” > “Website & SEO” > “SEO.” And past take nan type of page that you want to edit.

Wix dashboard displaying nan navigation sidebar pinch nan "SEO" section highlighted

Scroll down until you spot “Tools & Settings” and prime “Go to SEO Settings” from nether “SEO Settings.”

Wix dashboard showing "Tools and settings" for SEO, pinch a highlighted "Go to SEO Settings" button

Then, prime nan type of page you want to set your canonical tags for.

For this workflow, we selected “Main Pages.” 

SEO settings sheet pinch nan "Main pages" action highlighted by a purple border

Next, prime nan “Edit” fastener adjacent to “Additional Meta Tags.”

SEO settings for Main Pages, pinch nan past section, "Additional meta tags," highlighted successful a purple box

Then, adhd variables to nan section nether “canonical” by clicking connected “+ Add Variable.” And selecting applicable items from nan database that appears.

Wix personification interface showing options for editing canonical tags

You tin besides edit nan canonical tags of individual pages. Just spell to your editor and prime “Pages & Menu” > “Store Pages.” 

Then, find nan page you’re focused on, click nan three-dot icon, and prime “SEO Basics.”

Wix website editor displaying "Store Pages" nether "Site Pages and Menu," pinch "SEO Basics" selected for nan shop page

Then, spell to “Advanced SEO” > “Additional Tags.” And set nan canonical tag according to your needs. 

canonical tags successful nan Wix website editor for nan shop page

Other Ways to Specify Canonical URLs

Typically, you specify canonical URL preferences utilizing canonical tags. But location are different methods.

Let’s look astatine these deduplication methods successful much detail.

A rel=“canonical” HTTP header allows you to specify a canonical URL for non-HTML documents.

For example, if you person a DOCX and PDF type of nan aforesaid archive online, you tin usage this method to bespeak your preferred version.

But you request to beryllium capable to alteration your server’s configuration.

In nan .htaccess file, specify a canonical URL by adding codification that looks for illustration this:

Header add Link: <https://www.example.com/downloads/filename.pdf>; rel="canonical"

Redirect Duplicate Pages to Canonical Pages

URL redirects nonstop Google (and users) from 1 page to another. 

Redirecting is nan champion deduplication method if you don’t request to support nan alternate versions of nan page. But you don’t want to delete nan URLs altogether.

For example, erstwhile you person HTTP and HTTPS versions of nan aforesaid page. 

Google prefers HTTPS versions. So, it’s bully for your SEO to redirect nan HTTP type to nan HTTPS one.

Google recommends utilizing 3xx redirects (server-side redirects) for nan quickest results. 

This includes nan 301 redirect, which you tin study much astir successful our 301 redirect guide.

List Canonical URLs Only successful Your Sitemap

All nan pages listed successful your sitemap bespeak your suggested canonical URLs, according to Google.

This intends it’s a bully thought to taxable canonical URLs (and non-duplicated pages) only successful your sitemap. And time off alternate URLs out. 

It’s not a immense rumor if you time off copy pages successful your sitemap. Google will determine which type is canonical. 

But it could beryllium a problem if you accidentally time off preferred URLs out. So, support your sitemap updated.

If you don’t instrumentality canonicals correctly, Google mightiness disregard them. And that tin harm your SEO performance.

So, travel these canonical tag champion practices for nan champion results:

Specify One Canonical URL Per Page

Only specify one canonical URL per page. Otherwise, you’ll confuse Google.

Be observant not to accidentally see 2 canonical tags wrong your page's HTML code. If you group nan canonical tag utilizing a mounting successful your CMS, don't manually adhd further canonical tags to your HTML.

And if you adhd rel="canonical" to nan HTML, don’t besides adhd it to nan HTTP header.

Specify nan Correct Domain Protocol

If your tract sits connected nan HTTPS protocol, beryllium judge to reference this arsenic your canonical URL. 

Check retired our guideline to study much astir redirecting from HTTP to HTTPS.

Specify Trailing Slash aliases Non-Trailing Slash URLs

Pay attraction to whether your pages usage trailing slashes (i.e., “/” symbols astatine nan extremity of URLs). 

For example: 

  • Trailing slash: https://example.com/
  • Non-trailing slash: https://example.com

If nan aforesaid URL exists pinch some nan trailing slash and without, Google whitethorn spot them arsenic 2 abstracted URLs. So, beryllium judge to reference your canonical URL correctly by including nan trailing slash if needed.

And effort to beryllium accordant crossed your site.

Specify Non-WWW aliases WWW URLs

Search engines spot non-WWW and WWW versions of a URL arsenic copy pages.

For example: 

  • Non-WWW: https://example.com/
  • WWW: https://www.example.com/

It’s champion to take 1 type and instrumentality pinch it crossed your full site.

Use Absolute URLs

Canonical tags should beryllium referenced utilizing absolute URLs alternatively than comparative URLs.

That intends you should usage nan afloat URL, including your domain. Like this:

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

And not a comparative URL. Like this:

<link rel="canonical" href="/blog/" />

Common Mistakes to Avoid When Implementing Canonical Tags

It’s easy to make mistakes erstwhile implementing canonical tags. 

Here are immoderate of nan much communal canonical tag errors:

Pointing Canonical Tags to Redirected Pages

Be observant not to specify a canonical URL that redirects. This will only confuse Google.

For example, let’s opportunity Page A redirects to Page B.

You shouldn’t person immoderate canonicals that constituent to Page A. They should constituent straight to Page B instead.

Using Canonical Tags for Non-Duplicate Content

Only group canonical URLs for copy aliases near-identical content. 

Some SEOs effort to usage canonical tags to consolidate nan ranking powerfulness of dissimilar pages. Like directing authority from out-of-stock merchandise pages to class pages.

But Google advises against this practice. And is highly apt to disregard these canonicals.

You besides mightiness beryllium tempted to usage canonical tags for akin products. But moreover if 2 products are alike (like 2 different models of headphones), they should some person their ain sets of canonical tags.

If Google honors those canonical tags, users whitethorn struggle to observe applicable products. And that tin negatively effect your sales.

Placing Canonical Tags successful nan Wrong Place

Canonical tags must beryllium successful nan <head> conception of your HTML. 

If you put them successful nan incorrect place, hunt engines mightiness not find aliases admit them. And your pages mightiness extremity up competing against each different successful hunt results.

To double-check that your placement is correct for immoderate page, spell to that page’s URL, right-click connected nan page, and prime “View Page Source.”

Semrush Blog article pinch nan browser discourse paper successful nan foreground and a ray purple arrow pointing to "View page source"

Then, type Command + F (on a mac) aliases Ctrl + F (on a PC), and participate “canonical.”

You should past beryllium capable to spot whether it’s located successful nan due place.

article HTML codification pinch nan <link rel="canonical"> tag highlighted

If it's not successful nan <head> section, you’ll want to move it there.

Having Conflicting Canonical and Hreflang Tags

When you person a multilingual site, you'll often usage some canonical tags and hreflang tags (HTML that specifies a page’s connection and sometimes its location). 

Canonical tags show hunt engines which type of a page is nan main one. 

Hreflang tags show hunt engines which connection you're utilizing connected a circumstantial page. To guarantee nan correct type is shown to users successful different countries. 

diagram showing an hreflang tag pinch connection worth (en-us) successful red, state worth (us) successful green, and URL successful purple

Let's opportunity you person a page astir cats successful 3 languages.

  • English: https://example.com/cats
  • Spanish: https://example.com/es/gatos
  • French: https://example.com/fr/chats

A communal correction would beryllium to database “https://example.com/cats” arsenic nan canonical URL connected each page. 

That sends conflicting messages to Google. And could consequence successful nan incorrect connection type being shown to users successful a fixed country.

To instrumentality some tags correctly, each page should state itself arsenic nan main type successful its language. And database each disposable connection versions, including itself.

On nan English page, you'd use:

<link rel="canonical" href="https://example.com/cats" />
<link rel="alternate" hreflang="en" href="https://example.com/cats" />
<link rel="alternate" hreflang="es" href="https://example.com/es/gatos" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/chats" />

On nan Spanish page, you'd use:

<link rel="canonical" href="https://example.com/es/gatos" />
<link rel="alternate" hreflang="en" href="https://example.com/cats" />
<link rel="alternate" hreflang="es" href="https://example.com/es/gatos" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/chats" />

On nan French page, you'd use:

<link rel="canonical" href="https://example.com/fr/chats" />
<link rel="alternate" hreflang="en" href="https://example.com/cats" />
<link rel="alternate" hreflang="es" href="https://example.com/es/gatos" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/chats" />

Find retired what Google considers to beryllium nan canonical URL for immoderate page connected your website pinch Google Search Console.

After logging in, hunt for a URL astatine nan top.

Google Search Console interface highlighting a URL successful nan hunt bar

When nan “URL Inspection” study is ready, unfastened nan “Page indexing” section.

Scroll down to spot nan “Google-selected canonical.”

Google Search Console showing “URL Inspection” study pinch nan “Google-selected canonical" successful nan “Page indexing” section

If this isn’t your preferred URL, you whitethorn request to reappraisal your deduplication efforts. 

To start, make judge that nan “User-declared canonical” is coming and correct.

To audit your site’s canonical tags astatine scale, usage Semrush’s Site Audit tool.

Open nan tool, participate your domain, and click "Start Audit."

Semrush's Site Audit instrumentality interface pinch an input section for a website URL and a greenish "Start Audit" button

Configure your Site Audit Settings to group up your crawl. And purpose to crawl arsenic galore pages arsenic possible—to guarantee you don’t miss immoderate issues. 

Check nan container adjacent to "Send an email each clip an audit is complete." And click "Start audit."

"Site Audit Settings" model pinch navigation paper and configuration options

When nan audit is done, spell to nan “Issues” tab. And hunt “canonical.”

Site Audit instrumentality "Issues" tab highlighting canonical issues recovered connected a website

Check for nan pursuing errors:

  • # pages person copy contented issues
  • # pages person aggregate canonical URLs
  • # pages pinch a surgery canonical link
  • # AMP pages person nary canonical tag
Site Audit results showing nan database of different issues and errors, including copy contented and surgery canonical links

Let’s look astatine what these issues are and really to hole them.

# Pages Have Duplicate Content Issues

This correction shows really galore pages connected your tract could beryllium considered duplicates. Because they characteristic contented that’s astatine slightest 85% identical to nan contented connected different page.

Click nan nexus to spot affected URLs.

results page displaying 17,764 pages pinch copy contented issues for circumstantial URLs

You tin past determine really to resoluteness nan issue. See our duplicate contented guide for advice.

# Pages Have Multiple Canonical URLs

This correction shows really galore pages connected your tract specify much than 1 canonical URL.

Click nan nexus to position a elaborate breakdown.

"3 pages person aggregate canonical URLs" page

To hole this issue, region nan other canonical tag(s). And time off conscionable 1 successful place. 

This rumor shows which pages connected your tract person surgery canonical links—i.e., specify a canonical URL that doesn’t work.

(Perhaps because it contains a typo. Or nan page has been deleted.)

Click nan nexus to spot nan affected pages and nan canonical URLs they constituent to.

"Issues" tab showing 120 pages pinch surgery canonical links

Canonical tags that constituent to non-existent webpages complicate Google’s expertise to crawl and scale your contented properly. That could harm your rankings.

So, make judge to update these to nan correct canonical URLs.

# AMP Pages Have No Canonical Tag

When your AMP pages don’t person canonical tags, nan Site Audit instrumentality flags it arsenic an issue. It’s important that canonicalization beryllium successful spot betwixt AMP and non-AMP versions of your page.

You tin hole this problem by adding a rel="canonical" tag successful nan <head> conception of each AMP page that points backmost to nan non-AMP page.

Like this:

how to hole an AMP page without a canonical tag

When you’ve fixed this and immoderate different issues, rerun nan Site Audit utilizing nan cogwheel icon. 

highlighted cogwheel icon successful nan upper-right corner, showing a dropdown paper pinch an action to rerun nan campaign

Then, cheque that nan canonical errors person vanished by utilizing nan hunt barroom erstwhile more. 

Start Specifying Canonical URLs

Correctly implementing canonical tags is simply a cardinal portion of method SEO. And tin thief amended your integrated hunt rankings.

So, audit your website to spot if it has immoderate issues related to canonical URLs.

Try it pinch Site Audit.

This station was updated successful 2024. Excerpts from nan original article by James Brockbank whitethorn remain.

More