Beginner’s Guide to Canonical Tags
What Is a Canonical URL?
In order to prevent duplicate material from appearing in search results, search engines like Google select and prioritise the primary version of a webpage, known as the canonical URL.
For example
Canonical URL: https://example.com/blog/
Non-canonical URL: https://example.com/blog/?page=1
How Google Indexes and Chooses The Canonical URL
Google determines each page’s main content, also known as the centrepiece when it indexes a page. Google selects the page that, according to the criteria (or signals) the indexing process gathered, is objectively the most comprehensive and helpful for search users and classifies it as canonical if it discovers several pages that appear to be identical or the main material is very similar. To lessen the crawling strain on websites, duplicate pages are crawled less frequently than the canonical page.
When assessing content and quality, Google mostly references the canonical page. Unless one of the duplicates is specifically more appropriate for a search user, a Google search result typically directs users to the canonical page.
What Is a Canonical Tag?
An HTML snippet that indicates the primary version among duplicate or almost duplicate pages on your website is called a canonical tag (also called the rel=”canonical” tag).
Canonical tags in SEO instruct Google on which version of a page to index, transfer link equity (ranking strength) to, and present in search results.
If you look at your website’s HTML source code you will be able to detect canonical tags by searching for <link rel=”canonical” href=”https://example.com/page/” />
It’s also a good idea to use self-referencing canonical tags, which means that every canonical page should contain a canonical tag pointing to its own URL.
Why Do We Need to Use Canonical Tags?
There are several reasons to specifically inform Google about a canonical page among a collection of duplicate or similar sites, even if it’s usually not necessary to indicate a canonical preference for your URLs:
- To indicate the URL you would like to see in search results.
- To combine signals for pages that are duplicates or similar. It makes it easier for search engines to combine the signals they have for each URL—like links to them—into one preferred URL.
- To make monitoring metrics for a piece of content easier. It may be more difficult to obtain consolidated analytics for a particular piece of content when there are multiple URLs.
- To prevent wasting crawling time on pages that are already duplicated. It might be better for Googlebot to spend time crawling new (or updated) pages on your website rather than crawling multiple versions of the same information.
Best Canonical Tags Practices
Use the following best practices for all canonicalisation techniques:
- The robots.txt file should not be used for canonicalisation.
- The URL removal tool in Search Console should not be used for canonicalisation. All variants of a URL will be hidden from the Google search.
- Don’t use different canonicalisation strategies to designate different URLs as canonical for the same page (for instance, don’t use rel=”canonical” to specify one URL in a sitemap but another URL for the same page).
- Since Google often doesn’t support URL fragments, don’t designate a URL fragment as canonical.
- If you’re using hreflang elements, add a canonical page in the same language, or the best possible substitute language if a canonical page doesn’t exist for the same language.
- Linking the correct URL that you consider canonical within your website structure helps Google understand your preference.
How to Set Canonical Tags in WordPress
Setting canonical tags in WordPress can be done either manually or using plugins. The most popular plugin that WordPress users use is Yoast.
On this Yoast help page, you will see step by step guide on how you can change the canonical URL, you just need to install the plugin on your website.
How to Set Canonical Tags in Shopify
To avoid duplicate content, Shopify automatically adds canonical tags to important pages. For instance:
Product pages: The canonical tag points to the main product URL.
Collection pages: Canonical tags point to the main collection URL.
If you need to add or modify canonical tags, you can do this by manually editing your theme’s code.
Access Theme Editor:
- Log in to your Shopify admin.
- Go to Online Store > Themes.
- Click Actions > Edit Code for the active theme.
Locate the Relevant Template:
- For products: Open the product.liquid file.
- For collections: Open the collection.liquid file.
- For other pages: Edit the respective .liquid file.
Add Canonical Tag: Insert the following code within the <head> section of the template:
<link rel=”canonical” href=”{{ canonical_url }}”>
Shopify’s {{ canonical_url }} outputs the main URL of the current page.
Customise the Canonical URL (Optional): If you want a specific canonical URL for certain pages, you can hardcode it. For example:
<link rel=”canonical” href=”https://yourdomain.com/preferred-url”>
Save Changes:
- Click Save to apply the changes.
If you prefer a no-code solution, you can use an SEO app to manage canonical tags. Popular options include:
- Plug In SEO
- Smart SEO
- JSON-LD for SEO
These apps often provide an interface to customise canonical tags easily without editing the theme code.
In conclusion, canonical tags play a crucial role in optimising your website by preventing duplicate content and improving search engine efficiency. Implementing them correctly ensures search engines understand your preferred URLs. Whether you’re using WordPress, Shopify, or another platform, following best practices for canonicalisation is essential. If you need Technical SEO services, CRKLR is here to help fix your website issues and optimise your canonical tags for better results.