Duplicate content is a common problem encountered by webmasters. When you publish a piece of content on your website, it may appear on multiple URLs. Duplicate content such as this creates confusion in search engines’ algorithms while subsequently harming your website’s rankings.
Search engines won’t rank multiple URLs featuring the same content. When they encounter duplicate content, they’ll pick a single URL to rank in the search results. Unfortunately, search engines don’t always choose the right URL. They may ignore your preferred URL and, instead, rank an undesirable URL. Regardless of how much duplicate content your website has, though, you can use canonical tags to safeguard it from ranking issues.
What Are Canonical Tags?
Also known as a canonical link element, a canonical tag is a snippet of HTML code that specifies the preferred URL of a web page to search engines. As they crawl your website, search engines will look for canonical tags. If a page has a canonical tag embedded in its code, search engines won’t rank it. Rather, they’ll rank the URL specified in the canonical tag.
Canonical tags are designed exclusively for search engines. Unless a visitor views your website’s code, he or she won’t see them. Even then, canonical tags won’t affect how visitors see, use or interact with your website. They’ll only affect how search engines rank your website.
For any given page on your website, you can add a single canonical tag. This short and simple HTML snippet tells search engines which version of the page they should rank. You can technically add multiple canonical tags to a single page, but search engines won’t honor them. If a page has two or more canonical tags, search engines will rank the page rather than any of the URLs specified in the canonical tags.
When to Use Canonical Tags
You should use canonical tags to handle duplicate content on your website. If the same content appears on multiple URLs of your website, search engines will select one of the URLs to rank in the search results. Canonical tags allow you to tell search engines which URL they should rank. If you don’t use them, search engines may rank an undesirable URL while omitting your preferred version from the search results.
Canonical tags don’t prevent duplicate content; they only prevent ranking problems caused by duplicate content. The duplicate content will still be displayed on the alternative and undesirable URLs, but these URLs won’t rank in the search results. Search engines will prioritize the preferred URLs specified in the canonical tags.
Another instance in which to use canonical tags is to specify HTTP or HTTPS. In recent years, more and more websites have transitioned from HTTP to HTTPS. It’s a newer and more secure internet protocol that leverages cryptography to protect against data snooping. Whether your website uses HTTP or HTTPS, however, you can use canonical tags to specify which version you’d like search engines to rank.
Like with HTTP and HTTPS, you can use canonical tags to specify a www or non-www domain. Some webmasters prefer using a domain with a www prefix, whereas others prefer using a plain non-www domain. Without canonical tags, search engines may rank the wrong version. Therefore, you should use canonical tags to specify whether your website uses a www or non-www domain.
How to Create Canonical Tags
To create a canonical tag, you’ll need to add an HTML snippet to the header section of a page that you don’t want search engines to rank. Canonical snippets consist of the “link” element with the “canonical” rel attribute, both of which are proceeded by the preferred URL that you want search engines to rank.
Here’s an example of a canonical tag: <link rel=”canonical” href=”https://example.com/preferred-version-of-page”>. When placed in the header section of a page, it tells search engines to rank https://example.com/preferred-version-of-page as the preferred version. The page to which the canonical tag is added won’t rank in the search results.
Unfortunately, creating canonical tags for large websites can be difficult. For instance, if your website has 200 pages and you want to specify HTTPS as the preferred version, you must add a canonical tag featuring the appropriate HTTPS URL to all 200 pages. Some websites contain thousands of pages, making URL canonicalization a tedious process.
If you operate a WordPress website, you can use a plugin to create and add canonical tags on the fly. Over a dozen plugins, many of which are free, feature URL canonicalization. Both the free and premium versions of Yoast SEO support URL canonicalization. The well-known plugin will create canonical tags for all pages on your website with duplicate content, though you’ll still have the freedom to create custom canonical tags manually. If you prefer a different plugin, search the plugin repository for “canonical,” which should provide alternative options for instant canonicalization.
Canonical Tags vs 301 Redirects
Canonical tags are often confused with 301 redirects because of the similar way in which they are treated by search engines. If you use a 301 redirect on a page, search engines will typically rank the URL to which it redirects. With that said, 301 redirects work differently than their canonical counterparts.
A canonical tag is simply an HTML link element that specifies the preferred version of a page, whereas a 301 redirect is an HTTP response code that denotes the permanent relocation of website content. If you move a page of content to a new URL on your website, you can create a 301 redirect to the page’s new location.
301 redirects are distinguished from canonical tags in their ability to automatically redirect visitors. Users who try to visit the page’s old URL will be redirected to the URL of its new location. Canonical tags, on the other hand, don’t redirect visitors.
Search engines have become smarter over the years, but they still rely on canonical tags to determine which URLs to index. If multiple pages have the same or similar content, search engines will look for a canonical tag. With URL canonicalization, you can tell search engines which version to rank.
Latest update
Google Search Central’s latest documentation update, clarified the extraction of rel=”canonical” annotations with certain attributes are not used for canonicalization.
The rel=”canonical” annotations help Google determine which URL of a set of duplicates is canonical. Adding certain attributes to the link element changes the meaning of the annotation to denote a different device or language version. This is a documentation change only; Google has always ignored these rel=”canonical” annotations for canonicalization purposes.
Google says “rel=”canonical” annotations that suggest alternate versions of a page are ignored; specifically, rel=”canonical” annotations with hreflang, lang, media, and type attributes are not used for canonicalization. Instead, use the appropriate link annotations to specify alternate versions of a page; for example, link rel=”alternate” hreflang for language and country annotations.”