What is Canonical URL and How to Use it in WordPress?
The word SEO is an umbrella term covering A to Z of optimizing a website. There are many jargons used in SEO like nofollow, noindex, canonical, etc,. Though some terms are easy to understand some others are not. Canonical URL is one such term not easy for all users to understand. Especially using content management systems like WordPress makes it difficult to understand how exactly it works. In this article let us explore more on what is canonical URL and how to use it in WordPress site.
Duplicate URL Issue in WordPress
In order to understand the canonical URL, first you should understand the content duplication issue. Let us take a simple example in WordPress that you have a blog post received 100+ comments. Now that the page length is so long you are deciding to breakdown the comments into 20 per post on your site. This can be easily done by going to “Settings > Discussions” from your WordPress admin panel.
Now what exactly happens here is that a single post is divided into multiple pages. The content is same but the comments are different. This will be generally divided like below:
- Yoursite.com/post-name/ (81 - 100 comments)
- Yoursite.com/post-name/comment-page-1 (61 - 80 comments)
- Yoursite.com/post-name/comment-page-2/ (41 - 60 comments)
- Yoursite.com/post-name/comment-page-3/ (21 - 40 comments)
- Yoursite.com/post-name/comment-page-4/ (1 - 20 comments)
From the search engines like Google, these three pages are completely different as the URL are different. In reality it is not the case, as the content is same on all these pages. This will result in duplicate content and search engines will penalize the page and lower the rank on the results.
Informing Search Engines About the Correct URL
In the above URL duplication issue, the solution is to inform search engines about the correct and single URL. This correct and single URL is called “Canonical URL” which helps search engines to understand all these pages are same and pointing to a single resource (that is URL) on your site.
Above is a very simple example, but there are many situations you may need to manually split single post into multiple pages.
Examples of Duplicate Content Issue in WordPress
Let us assume you will not add the same content on two pages knowingly. But there are many other factors do that:
- Same URL with and without taxonomies like category and tag
- In the above example, two different bloggers link to two different comment pages while the content is same, Google will get confused as a search engine
- With and without HTTP / HTTPS
- With and without WWW
- Using parameters like sessions id, topic id and reply id in URLs is very common in forum sites
- Multiple posts have same titles or meta description
- You may be writing part, 1, 2, 3 and 4 of same article in 4 different posts.
In all such scenario, you as a site owner is responsible to inform search engines about the correct URL where the original content is located.
Using Canonical Link Tag
As the situation is more valid, there is a predefined solution to avoid duplicate content issue. You should add the below link tag inside the header section of each duplicated pages.
<link rel="canonical" href="Original Content URL">
The rel="canonical" link tag will inform Google and other search engines that the mentioned URL is the target URL for the content though the actual URL may be different.
It should be added like below when you look into the source HTML of your site.
How to Add Canonical URL in WordPress?
WordPress is a complex package which does not have a default option to insert link tags into the head section of your site. So the solution is to go for a SEO plugin. As far as we have checked all the popular SEO plugins have this option. Let us take an example of Yoast SEO plugin. After installing navigate to the post editor and go to the SEO meta box below the content.
Under “Advanced” section, you will the canonical URL box for you to enter the correct URL.
It also makes it very easy by adding the canonical URL automatically for the cases like comment pagination, page breaks, etc.
How to Find Existing Content Duplication?
Well, it is easy to add the canonical tag to the new pages you create. What about the existing pages on your site? There are no simple solutions. Yet you can use Google Search Console to find the pages having duplicate titles and meta description.
Login to your Google Search Console, and navigate to “Search Appearance > HTML Improvements” section. There you will see all duplicate content issues detected by Google.
Click on the issue which shows the count to see more details of the issue. Below is an example, Google still shows it as a duplicate meta description on all blog index pages though each index page has canonical URL.
Check and take necessary actions you can take to remove the duplicate titles and meta description.
301 Redirect Vs Canonical Link Element
You may be wondering the difference between the 301 redirect and canonical link element. It is very simple, set 301 redirect for the following situations:
- Page URL is changed
- Content is moved from one location to another location within or across the site
Basically 301 redirect is used for retaining the page rank of the existing URL. While rel="canonical" tag is used to avoid content duplication.