Canonical - Pagination
- 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
Can you please post a feature request at
https://github.com/bludit/bludit/issues
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
For example: https://yourmypage.com/?page=2 or 3,4,5.
Googgle indexes these pages to produce duplicate content.
Googgle indexes these pages to produce duplicate content.
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...
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...
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.
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.
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.
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;
}
*/
}
}