What Are Canonical URLs: An In-Depth Guide for SEOs
A canonical URL is the original or primary version of a webpage. If your site hosts multiple pages with similar or identical content, the canonical URL is the one you want search engines to index.
While search engines ultimately determine which URL they consider canonical, you can influence this decision by adding the “rel=canonical” link element in your webpage’s HTML code.
Here’s how Atlassian adds a canonical link tag for the Jira landing page on their site:
Let’s break that down:
- The rel=”canonical” link element tells search engines that the link that follows is the preferred version of the page
- The href attribute then specifies the URL considered to be the original page
How Do Canonical URLs Affect SEO?
Canonical URLs help address duplicate content issues on your website.
When multiple URLs lead to pages with the same content, search engines may have difficulty selecting the correct page to display in search results.
But when you set a canonical URL, you clearly indicate which page you want indexed and ranked. Which helps search engines make a decision.
How to Implement Canonical URLs
Even the largest websites can slip up when it comes to implementing canonical URLs correctly.
Here’s what you should do to make sure you implement them properly.
1. Audit Your Website
Start by auditing your site for duplicate content—which can happen in multiple ways, including:
- Publishing identical content on different URLs
- Creating multiple page variations for A/B testing
- Generating URLs with tracking parameters
You can use Semrush’s Site Audit; tool to find and address duplicate content issues on your website.
Here’s how:
Enter your website URL and click “Start Audit.”
The tool will then analyze your entire website’s structure and content.
Once the audit is complete, navigate to the “Issues” report.
Filter the list by typing “duplicate” in the search bar.
Next, click the linked text in each section.
This will take you to a list of pages that have a specific issue. In this case, duplicate content.
Click on the “Why and how to fix it” link to learn more about the issue and how to address it.
To check for canonicalization issues, click on the “Statistics” tab and have a look at the “Canonicalization” section.
By clicking on the linked part of the section, you’ll able to review pages with canonicalization issues such as:
- Multiple canonical URLs
- Broken canonical links
- Missing canonical tags
2. Choose the Canonical Version
Once you’ve identified duplicate pages and canonical issues, select the version you’d prefer search engines to index and show in search results.
Sometimes, the best choice will be clear. Other times, it will require careful consideration.
Follow these guidelines to make the right choice more easily:
- Choose the most user-friendly URL
- The most informative page should typically be the canonical version
- Prioritize the URL with the most internal links
- If one version has consistently outperformed others in search rankings, consider making that the canonical URL
- Avoid URLs with unnecessary parameters, such as session IDs and tracking codes
3. Add Canonical URLs
For each group of duplicate or similar pages, add a <link rel=”canonical”> attribute to specify your preferred version.
You typically add the canonical link element in the <head> section of a page.
Here’s what this looks like in practice, using Airtable as an example.
The visible homepage URL is:
https://www.airtable.com/v2
But this isn’t the canonical URL they want indexed. It’s actually:
https://www.airtable.com/
Here’s how they set up the canonical URL in the HTML code on both versions of the page.
This means the original version of the page (“https://www.airtable.com/”) includes a canonical link pointing to itself.
The variant (“https://www.airtable.com/v2”) uses a canonical URL pointing back to the original version.
And this helps Google understand which page to prioritize, as seen in the screenshot below.
Best Practices for Canonical URLs
Let’s take a closer look at the best practices for adding canonical URLs to your website.
Some of these may seem like minor details, but they can affect how search engines index and rank your content.
1. Use Absolute URLs
Always use the full URL, including the “https://” prefix.
Do this:
<link rel="canonical" href="https://backlinko.com/hub/seo/seo-keywords">
Not this:
<link rel="canonical" href="https://backlinko.com/hub/seo/seo-keywords">
Using absolute URLs eliminates any potential confusion for search engines.
2. Be Consistent
Before you set up a canonical URL, make sure the corresponding version exists on your website.
Also, double-check for any typos.
And make sure the URLs that have been deleted or redirected are promptly updated in the canonical link element.
3. Enforce a Self-Referencing Canonical URL
Use a canonical link element that points to the preferred page’s URL in the HTML code of the preferred page itself.
This reinforces to search engines that the current page is the one they should prioritize in search results.
Even if a page doesn’t have duplicates, using a self-referencing link can prevent issues caused by incorrect URL parameters.
4. Designate One Canonical Link Element Per Page
When multiple canonical URLs are specified, search engine crawlers may find it difficult to determine your preferred version of the content.
This can result in indexing and ranking issues.
Common Mistakes to Avoid When Implementing Canonical URLs
Make sure to avoid these mistakes when implementing canonical URLs.
1. Adding Canonical Tags in the Wrong Place
Place the rel=”canonical” link element in the <head> section of your HTML document. Not in the <body>.
Adding it outside the <head> tags violates HTML standards and might cause browsers and search engines to misinterpret or incorrectly render your page.
2. Using Multiple Canonical Tags
Having multiple canonical URLs can harm your search engine rankings.
Why? Search engines, like Google, are likely to ignore all the conflicting canonical URLs you’ve added—which defeats the purpose of using canonical tags.
3. Ignoring Near Duplicates
Near-duplicate pages look almost identical but have small differences—like varied product options or slight language variations.
Here’s how to handle them:
- Decide if near-duplicate pages should point to a preferred version using a canonical link element
- If both pages add value for users, consider changing the content on each page to make them substantially different
4. Pointing Canonical Tags to Redirected URLs
Make sure the canonical URL link element points to the final, preferred URL directly. And not to URLs that redirect.
This usually happens during site restructurings, migrations, or consolidations when canonical link elements aren’t updated to follow the new URL structure.
Pointing a canonical tag to redirecting URLs complicates the job for search engines because it makes them go to a URL, only to get redirected again.
To prevent this, regularly verify that your canonical link elements reflect the most current, direct URLs.
5. Canonicalizing Paginated Pages to the Root Page
Avoid setting all pages in a series to canonicalize back to the series’ first page—as this could cause search engines to ignore the content on later pages.
Instead, let each page in a pagination series stand independently by using a canonical link element that points to its own URL.
For example:
If your ecommerce site features product categories across multiple pages like this:
- Page 1: www.yourwebsite.com/category?page=1
- Page 2: www.yourwebsite.com/category?page=2
- and so on
Make sure to assign a canonical link element to each page, directing back to its specific URL:
- For Page 1: <link rel=”canonical” href=”www.yourwebsite.com/category?page=1″/>
- For Page 2: <link rel=”canonical” href=”www.yourwebsite.com/category?page=2″/>
Advanced Canonicalization Techniques
Choosing the correct canonical URL can sometimes present challenges.
Below, you’ll find scenarios where this might be the case. Plus, practical advice on how to navigate these situations.
Redirects and Canonical URLs
Redirects and canonical tags play complementary roles in handling duplicate content.
But first, what’s the difference?
- Redirects automatically take both users and search engines to the correct page. The result? A smooth user experience and accurate search engine indexing.
- Canonical link elements act as suggestions to search engines about which URL to index—without changing the user experience. They act as behind-the-scenes instructions for search engines.
As you can see, they both serve unique purposes. But when you use them together correctly, you improve the user experience and make it easier for search engines to understand your website.
When to Use Each
The choice between using canonical URLs, redirects, or a combination of both depends on a few factors:
- Type of duplicate content: When duplicate content serves the users or is intentionally created, use a canonical link element. Examples include URLs for product variations or URLs with UTM parameters for tracking marketing campaigns. By doing so, you signal to search engines your preferred content version while keeping user access to other versions.
- Desired URL structure: For major site overhauls, redirects (especially 301s for permanent changes) are necessary. This makes sure that users and search engines are automatically redirected from old URLs to new ones. There’s usually no need to add a canonical link element to these redirected pages.
- Your SEO goals: Redirects are generally more effective for consolidating link equity. Canonical tags allow users to access multiple versions of a page while focusing search engine attention on one version.
Let’s make this clearer with a practical example.
Imagine you run an ecommerce site that’s had multiple marketing campaigns, leading to several URLs for the same product page. This might result in some URLs that are no longer useful. You might have the following URLs on your site:
The original product page:
www.yourwebsite.com/product
A product page specific to the campaign:
www.yourwebsite.com/spring-sale/product
A product page URL with UTMs:
www.yourwebsite.com/spring-sale/product?utm_source=newsletter&utm_medium=email&utm_campaign=spring_sale
In this situation, here’s what we recommend:
Apply a canonical tag on all versions of the product page, pointing to the original URL.
After the campaign ends, use redirects to funnel visitors from campaign-specific URLs to the original product page to consolidate link equity. A canonical tag is generally not necessary in this case.
For URLs with tracking codes, decide based on your tracking needs—either redirect them or leave them as is. Make sure the page has a canonical link that points to the basic, non-parameter version of the URL.
Canonical URLs for Ecommerce Sites
Ecommerce sites often face duplicate content issues because multiple URLs can be generated for the same product. Especially when products come in different colors and sizes or are viewed through various filters.
Here’s how to manage this with a focus on canonical URLs, using the Hugo Boss website as an example.
Hugo Boss’s product pages generate different URLs for different colors of the same product.
In this example, the URL for the blue product variant is:
https://www.hugoboss.com/uk/micro-structured-crew-neck-sweater-in-cotton/hbeu50506022_479.html
While the URL for the dark red variant is:
https://www.hugoboss.com/uk/micro-structured-crew-neck-sweater-in-cotton/hbeu50506022_248.html
So, what does the website do?
It designates the URL of the first color option displayed on the product page as the canonical URL.
For most ecommerce sites, the best way to manage dynamically generated URLs like this is to use built-in features or SEO plugins that facilitate canonicalization.
With Shopify, for example, you can use the Canonical Tag URL Wizard app.
Canonical URLs and Multilingual Sites
For multilingual sites, pair hreflang attributes with canonical link elements.
Here’s how to approach this:
For each language version of your content, use hreflang attributes to define the target audience by language and region.
At the same time, set a canonical URL for each page to inform search engines about the preferred version for that particular language setup.
Take Shopify’s execution as an example:
Here’s the canonical attribute on the English version of their site.
Notice the canonical attribute links to:
"https://www.shopify.com/pricing"
And here’s what that looks like on the French version of the same page on their site:
See the canonical attribute?
It links to the French version of the page:
“https://www.shopify.com/fr/tarifs”
Canonicalization Across Subdomains
When your website uses subdomains to organize content or host different language versions, use canonical URLs across these subdomains.
Semrush, for example, has subdomains for different language versions.
Let’s look at how they use canonical URLs.
On its main domain, “https://www.semrush.com,” they add:
<link rel="canonical" href="https://www.semrush.com/">
And on the French version of their site (https://fr.semrush.com/) they use:
<link rel="canonical" href="https://fr.semrush.com/">
This approach makes sure search engines recognize the primary content source across various subdomains.
Canonicalization Across Different Domains
For content syndicated across other sites, the use of canonical URLs has shifted.
Google now advises against using rel=”canonical” for syndicated content.
Instead, it recommends that partners implement the “noindex” meta tag to prevent syndicated content pages from being indexed.
Canonicalization in AMP Pages
For websites with Accelerated Mobile Pages (AMP)—which are optimized versions of webpages for quick loading on mobile devices—apply canonical link elements to manage content.
Here’s how:
- AMP to non-AMP: Put a canonical link element on each AMP page that points to its matching non-AMP (regular HTML) page. This tells search engines the non-AMP page is the main version.
- Non-AMP self-reference: Similarly, ensure that the non-AMP HTML version of a page has a canonical URL that points to itself
- AMP-only pages: In situations where an AMP page doesn’t have a corresponding HTML version, the canonical tag should point back to the AMP page itself
Go Beyond Canonical URL Optimization for Better Rankings
Using canonical tags helps search engines identify which version of a page to index and rank.
But canonicalization issues are just one of the problems that might be holding back your website from achieving higher search engine rankings.
Check out our guide to technical SEO to learn how to ensure your website is free of technical issues that might be hurting your rankings.
Source link : Backlinko.com