What is a canonical tag? An explanation
If the same content can be found on several URLs, this is known as duplicate content, which can result in the page in question not being indexed by the search engine. This poses a challenge, for example, for websites that offer almost identical content in the same language under different country-specific domains. One possible solution to this problem is to use the canonical tag, which enables you to specify a URL or URI as being the default resource for indexing.
What exactly is a canonical tag?
In 2009, Yahoo, Microsoft, and Google introduced the canonical tag, which would quickly become one of the most important SEO tools, and since 2012 has been labelled as the official web standard in RFC 9596. If a canonical link is embedded on a page, it refers to a specified standard URL or URI, which is also referred to as a canonical URL and should be used as the indexing source instead of this page.
The canonical URL combines its own link popularity and reputation as well as that of the referenced pages because it generates a better ranking this way. However, since the tagged URLs are not included in the index, there are no problems with duplicate content. The label is merely a recommendation to the search engines, indicating that the link attribute does not necessarily have to be included in the index. If it’s not implemented properly, there is even the risk that the entire site will be ignored, which is why it’s so important to use the canonical tag correctly.
- Improve your Google ranking without paying an agency
- Reply to reviews and generate social media posts faster
- No SEO or online marketing skills needed
How does the canonical tag work?
For the canonical tag to work, two things are required. Firstly, you need the exact URL of the desired canonical page to be specified as the default resource. Secondly, you need a link element in which you can insert the canonical URL including the canonical directive. The following code shows an example of a canonical tag in action:
<link rel="canonical" href="URL/URI of the canonical page">
htmlThe link element, which has no closing tag in HTML, contains the attributes rel and href as the empty element. The former is needed to specify the relationship between the current and the linked document, while the latter indicates where the linked document is to be found. The values required for this purpose are enclosed within the quotation marks. The ‘canonical’ rel-value indicates that the URL being linked is intended to be the canonical URL, which is specified in the href attribute below:
To ensure that the alternative pages now refer to the specified default resource, the code must be inserted into the head section of the respective HTML documents. If the contents are not in HTML format, such as with a PDF file, it is also possible to implement this in the HTTP header. This is logically associated with a somewhat different syntax:
Link: <URL/URI of the canonical page>; rel="canonical"
htmlWhen does it make sense to use canonical statements?
By definition, the canonical tag isn’t a factor that search engines must necessarily take into consideration. Since the code must also be implemented individually for each piece of multiple content and for each alternative URI, the question arises of whether the comparatively high effort is worth it. In the next few paragraphs, we will discuss four scenarios in which you should consider using the canonical tag.
Content is distributed on dynamic URLs
Dynamic URLs now play an important role, especially in e-commerce. Although the user-specific pages are an excellent and easy option for presenting the same content (including slight variations) to different users, they also create problems for the search engine crawler. Here, canonical tags are highly recommended to prevent possible duplicate content.
Content can be accessed via different URLs
Due to the structure, some web projects such as blogs, web stores, and advice portals offer content in several categories at the same time, and therefore often under different URLs. For example, a shop could feature a ‘green shirt’ at the same time on several URLs:
-
my-ecommerce.store/fashion/shirt-green
-
my-ecommerce.store/summerfashion/shirt-green
-
my-ecommerce.store/winterfashion/shirt-green
Content is often retrievable via different URLs due to a change in website structure or even a complete domain transfer. For cases like these, 301 redirects are always displayed, but if this isn’t possible for technical reasons, link rel=“canonical” can prove a useful alternative.
Content is available on different domains
You can use the canonical tag not only for internal linking, but also to link to an external domain. This way, you can easily have your posts on a different domain without creating duplicate content. Positive user signals, links, and other ranking-relevant factors are transferred to the original URL, which can significantly improve the performance.
Content has different formats
In some situations, it is useful to publish content in different formats and, for example, to offer not only HTML versions, but also PDF files and printable versions. To ensure that search engines do not analyse each variant individually and end up ranking the wrong version, it’s recommended to use canonicals.
If you have a valid SSL/TLS certificate, you should make sure the secured HTTPS URLs are canonical URLs and link to them from the unsecured variants (HTTP). The same also applies to mobile or AMP sites – for the latter, canonicals are even required.
Common errors when implementing canonical tags
A canonical URL is the optimal solution in many situations to avoid duplicate content on your site. Leading search engines take the canonical tag into account when indexing, recognising that you don’t want the same or similar content to be ranked. Incidentally, the positive search engine signals are consolidated in the main URL, which improves its positioning. At this point, however, it should be noted that using canonical tags can quickly end up having a negative effect if they aren’t properly labelled or are incorrectly implemented. The following sections show you the most common canonical errors.
With the free SEO Checker from IONOS, you can have your site’s SEO performance evaluated quickly and easily.
Numbered pages refer to a canonical URL
To prepare content in an appealing manner, many web operators resort to page numbering. News portals, in particular, use this method by dividing and numbering content on several pages. However, if you set canonical tags for content like this, and link later pages to the output URL using link-rel="canonical"
, you’re making a mistake. This is because the following pages are by no means duplicates, which means that unique content does not end up getting indexed. If you still want to give search engines information about the chosen numbering, there are two advisable approaches:
-
Link to the previous and subsequent page on each URL. You require the link attribute,
rel
, then replace the value"canonical
“ with"prev
“ or"next
“. - Using
link-rel="canonical"
, link to a one-page version of the relevant content, which combines all numbered pages.
Relative URLs don’t link to the desired canonical page
Like most HTML tags, the <link>
tag offers the possibility to specify absolute and relative URLs. While absolute URLs describe the entire path (including ‘http://’ etc.), relative URLs link to a particular folder on the current site without requiring the complete URL. For example, a relative path "images/image.jpg"
states that the image ‘image.jpg’ can be accessed in the sub folder entitled ‘images’. However, when using the canonical tag, using paths like these quickly leads to complications, which could mean that the crawler ends up completely ignoring the tag.
Google therefore links to the following, as an example:
< link rel="canonical" href="example.com/cupcake.html" >
htmlBecause of the missing HTTP prefix, the crawler interprets the URL example.com/cupcake.html
as a relative URL, assuming that the desired canonical URL is http://example.com/example.com/cupcake.html
. Ideally, you should always specify the full URL when you place the canonical tag, or alternatively, when you link to an absolute URL without a domain:
< link rel="canonical" href="/cupcake.html" />
htmlImplementing an SEO strategy incorrectly can sometimes have serious consequences for your site’s ranking. We’ll take you through the most common SEO mistakes so that you can avoid them.
Pages linking to more than one canonical URL
The nature of canonical URLs logically excludes a subpage from linking to several standard websites. Multiple links like these are created quickly when you work with a content management system or store software. Plugins and templates often use canonical tags automatically even if you have already specified a canonical URL. If you are using extensions like these, you should also check the source text and correct information if necessary. Otherwise, your efforts will probably be fruitless, since search engines are likely to ignore all canonical tags instead of preferring them.
- Intuitive website builder with AI assistance
- Create captivating images and texts in seconds
- Domain, SSL and email included
No canonical tags in the mobile version
If you provide a mobile version of your website as well as a desktop version, you’re faced with the possibility that a lot of things could go wrong. Even if pages can be indexed despite missing information, you should try to make it as easy as possible for search engines when collecting information and categorising it. For example, Google recommends using rel=“alternate” as an alternative and also recommends linking from mobile pages to desktop URLs using the canonical tag. Google has compiled a guide on extensive tips and possible approaches for mobile friendly websites.
SEO encompasses many webpage components, optimisation strategies and technical terms. It is therefore often difficult for beginners to find their way around. In our SEO glossary we teach you all the terms to do with search engine optimisation.
Canonical tags and hreflang contradict themselves
International web projects with different country domains are quite challenging when it comes to search engine optimisation. On the one hand, the pages of all variants should be ranked well and be displayed to the appropriate users; on the other hand, the risk of duplicate content should be reduced to a minimum. One of the most important tools is the hreflang attribute, which allows individual versions to be labelled as equivalent alternatives. For this purpose, however, it is necessary that these pages always link back to themselves. If URLs like these link to canonical URLs simultaneously by canonical tag, this is a contradiction for search engine crawlers.
This results in the search engine ignoring both signals and instead indexing websites based on other features. Therefore, you should avoid using both these instructions at the same time.
Not only does the combination of canonical URLs and hreflang lead to contradictions that have a negative effect on your site’s ranking, but using canonical tags and instructions such as nofollow
, noindex
or disallow
don’t bode well with Google.
The differences between canonical tags and 301 redirecting
At first sight, the canonical tag seems to be very similar to the 301 redirect. This redirect, which is based on the HTTP status code 301 (Moved Permanently), also signals to the search engines that these pages should be evaluated as individual versions. In addition, redirects also lead visitors to the original URL, while all other variants are eliminated. Pages with canonical tags are only marked as a copy for the search engines and therefore remain accessible to the user.
Another difference is the fact that search engines never ignore a redirect, while this may be the case when a recommended link element label is used. Last but not least, the two methods also differ in terms of their functionality when used across multiple domains. While the 301 redirect transports a page from domain A to domain B, the canonical tag states that only a correlation from domain A to domain B exists.