Canonical - Pagination

Post Reply
kosi77
Sr. Bludit
Posts: 33
Joined: Wed Jan 30, 2019 7:23 am

Hello guys!
How to make home page,category and tag canonical paginations.
I'm using a theme blekathlon.

Bludit is my favorite cms!
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

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
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
Jay
Master Bludit
Posts: 133
Joined: Mon Feb 11, 2019 8:41 pm

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?
kosi77
Sr. Bludit
Posts: 33
Joined: Wed Jan 30, 2019 7:23 am

For example: https://yourmypage.com/?page=2 or 3,4,5.

Googgle indexes these pages to produce duplicate content.
User avatar
Jay
Master Bludit
Posts: 133
Joined: Mon Feb 11, 2019 8:41 pm

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.
affiliate
Ssr. Bludit
Posts: 14
Joined: Mon Jul 04, 2022 1:25 pm
Been thanked: 2 times

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...
affiliate
Ssr. Bludit
Posts: 14
Joined: Mon Jul 04, 2022 1:25 pm
Been thanked: 2 times

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.
affiliate
Ssr. Bludit
Posts: 14
Joined: Mon Jul 04, 2022 1:25 pm
Been thanked: 2 times

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;
		}
		*/

	}

}
Post Reply