Page 1 of 1

Canonical - Pagination

Posted: Tue Feb 04, 2020 10:04 am
by kosi77
Hello guys!
How to make home page,category and tag canonical paginations.
I'm using a theme blekathlon.

Bludit is my favorite cms!

Re: Canonical - Pagination

Posted: Tue Feb 04, 2020 11:48 am
by Edi
Good idea. This is not yet part of the SEO settings.

Can you please post a feature request at

https://github.com/bludit/bludit/issues

Re: Canonical - Pagination

Posted: Thu Feb 06, 2020 2:02 pm
by Jay
kosi77 wrote: Tue Feb 04, 2020 10:04 am How to make home page,category and tag canonical paginations.
What do you mean by "canonical pagination" of home page?

Re: Canonical - Pagination

Posted: Fri Feb 07, 2020 10:43 am
by kosi77
For example: https://yourmypage.com/?page=2 or 3,4,5.

Googgle indexes these pages to produce duplicate content.

Re: Canonical - Pagination

Posted: Sun Feb 09, 2020 11:20 pm
by Jay
this is all about friendly urls
I've got no idea how deep are you into SEO, but in 2020 I don't see a single problem in this matter.

Re: Canonical - Pagination

Posted: Wed Aug 09, 2023 5:15 pm
by affiliate
hey, this is old but just to tell you that the canonical plug in does not work with pagination and this is kind of sad...

If you activate it, then if you have :
- https://site.com :
- https://site.com/?page=2
- https://site.com/?page=3

All these pages will have the same canonical and yet they can be very different pages.

https://foxglove-partner.com/balise-canonical/
(I translated it)

>> The most frequent errors
Making page 1 of a pagination the canonical url for all pagination urls starting from the page.
The content is supposed to be different on pagination pages, so Google doesn't recommend using the canonical tag in this case.

I don't know if this is possible to have it fixed...

Re: Canonical - Pagination

Posted: Wed Aug 09, 2023 5:21 pm
by affiliate
This can help too as the guy had a similar problem...
https://wordpress.org/support/topic/can ... for-paged/

Canonical is used when you have extremely similar content on different pages, so you indicate the canonical with the best version of your content on all these similar pages.

It's quite different with pagination as the content is not similar and also this can be a problem to index the articles on page 2, 3, 4, etc as theses pages can be excluded from index of google because of canonical.

Re: Canonical - Pagination

Posted: Thu Aug 10, 2023 12:20 am
by affiliate
To solve it, you need to modify code of canonical plugin :
go in bl-plugins/canonical/plugin.php

replace with this code.

canonical will work with pagination on pages home, category, tag, page. It will not show a canonical on search results. this is the behaviour we want for canonical.

Code: Select all

<?php

class pluginCanonical extends Plugin {

	public function siteHead()
	{
		global $url;

		$domain = trim(DOMAIN_BASE,'/');
		$filter = trim($url->activeFilter(), '/');
		$pageNumber = $url->pageNumber();

		if(empty($filter)) {
			$uri = $domain.'/'.$url->slug();
		}
		else {
			$uri = $domain.'/'.$filter.'/'.$url->slug();
		}
		
		if ($pageNumber>1) { $uri=$uri.'?page='.$pageNumber; }

		if ($GLOBALS['WHERE_AM_I'] === 'home' && $pageNumber==1) {
			//to avoid problems with domain and domain/
			$uri = DOMAIN_BASE;
		}

		//WHERE I AM can be home, page, category, tag, search
		//results of search should not be indexed, so no canonical for them
		if ($GLOBALS['WHERE_AM_I'] !== 'search') {
			return '<link rel="canonical" href="'.$uri.'"/>'.PHP_EOL;
		}

		/*
				if ($GLOBALS['WHERE_AM_I'] === 'home') {
			return '<link rel="canonical" href="'.DOMAIN_BASE.'"/>'.PHP_EOL;
		} elseif ($GLOBALS['WHERE_AM_I'] === 'page') {
			global $page;
			return '<link rel="canonical" href="'.$page->permalink().'"/>'.PHP_EOL;
		}
		*/

	}

}