How to Fix Pagination is Not the Same as Canonical WordPress
Pagination is Not the Same as Canonical – One of the problems that often occurs but is considered not too important is pagination which is not the same as the canonical URL.
In fact, this problem is severe which will have a fatal impact on the sustainability of rankings in Google search results. If your website or blog is thinking about or implementing SEO, of course, don’t take this problem lightly.
This article will fully discuss how to handle the problem of pagination not being the same as canonical. With this aim, the website or blog remains in the best position in Google search results.
Learn What Pagination and Canonical Are
Before getting into the core of the discussion, it’s a good idea to first know what pagination and canonical are. Here’s a brief explanation of the two terms:
What is Pagination?
Pagination is a technique used to divide content into several pages. Usually, pagination is often used for blogs, online stores, and web portals.
Why does it need to be divided into several pages? to make it easier for users to find the desired content. In addition, the content is not too long down which can cause user boredom scrolling to the bottom of the page.
What is Canonical?
Canonical is an HTML tag used to provide information to search engines about which URL is the primary version of a website page.
Also read: What Are Canonical URLs and their Effects on SEO?
The purpose of this HTML tag is to prevent duplicate content problems. Usually, there are several pages that have very similar or identical content. Using the canonical tag tells search engines that there is only one URL as the main version.
For example, if you have multiple pages with nearly identical content, you can use the canonical tag to designate one URL as the primary version. This helps search engines understand which page to index and display in search results.
Why Should Pagination and Canonical URLs Be the Same?
There are several important reasons why pagination and canonical urls should be the same. Among them is that search engines will consider different pages as duplicate content. Why duplicate? if pagination itself divides some content into several parts?
Of course it is still considered a duplicate because it still displays the same content outside the pagination section with a different url. For example, you have a blog page that has title content, a description of the page and a blog list section with pagination.
The content that changes is only in the blog list section, but the title and description of the blog page are still the same. This is what causes it to be considered duplicate content. This can cause SEO rankings to drop because search engines are not sure which page to index.
Overcoming Pagination is not the same as Canonical
Identify the problem, this problem occurs on the wrong pagination is on the second page the pagination URL is not the same as the canonical URL. See the image below:
In the image above, the page URL and the canonical URL should be the same. So how do you solve Pagination not the same as Canonical? Check out the steps below:
Note: this method only applies to WordPress users and the Yoast SEO plugin.
- Add the following code in the function.php file or use the code snippets plugin:
add_filter('wpseo_canonical', 'filterCanonical');
/**
* Filter the canonical URL so that paged custom queries include the page number in the canonical URL
* Example: https://example.com/videos/page/2
*
* @param $canonical
* @return string
*/
function filterCanonical($canonical) {
if (is_paged()) {
global $paged;
$pageNumLink = get_pagenum_link($paged);
$canonical = strtok($pageNumLink, '?'); // Remove GET variables
}
return $canonical;
}
2. Flush your WordPress permalinks
Conclusion
Overcoming pagination issues that do not match canonical is an important step in SEO optimization. By following the steps mentioned above, of course, this is a solution for the website to remain in an optimal position in search engines.
If you want to read more information about WordPress, SEO, and others, please click on the navigation menu of this blog. Hopefully, this was useful.