Prestashop: Solved - big problem about the canonical url in the category pages when there is pagination and multi languages

Created on 9 May 2019  路  17Comments  路  Source: PrestaShop/PrestaShop

Hi
It is strange that on 1.7.5.2 there are bugs like this
try to use a site with multi languages and go to the category pages with paginations
so you can see that the second page has a different canonical url of the first page because there is ?page=2
another problem is that you use the context->language->id and not the default language
so the italian pages have a different canonical url of english pages, and it is wrong

this code will solve this bug

in FrontController.php, function getTemplateVarPage

$id_category = (int) Tools::getValue('id_category');

        $page = array(
            'title' => '',
            'canonical' => isset($id_category) && $id_category ? $this->context->link->getCategoryLink($id_category, null, (int) Configuration::get('PS_LANG_DEFAULT')) : $this->getCanonicalURL(),
            'meta' => array(
                'title' => $meta_tags['meta_title'],
                'description' => $meta_tags['meta_description'],
                'keywords' => $meta_tags['meta_keywords'],
                'robots' => 'index',
            ),
            'page_name' => $page_name,
            'body_classes' => $body_classes,
            'admin_notifications' => array(),
        );

Screenshots
1
2
3

Additionnal information
PrestaShop version: 1.7.5.2
PHP version: 7.0

bye

1.7.5.2 Bug FO SEO & URLs TBS waiting for PM

All 17 comments

@maofree Wouldn't this code be better put in CategoryController::getCanonicalURL() ?
https://github.com/PrestaShop/PrestaShop/blob/develop/controllers/front/listing/CategoryController.php#L53

Hi @maofree,

Thanks for your report.
About the first issue:

the second page has a different canonical

It the same behavior with PS1.7.5.1 & PS1.7.5.2.
I think different page => different content => so we don't have duplicated content
ping @matks @jolelievre what do you think?
About the second issue, as you can see in this comment https://github.com/PrestaShop/PrestaShop/issues/9500#issuecomment-415453287
It is logical to have different canonical when the language is changed
Different language = different content
Thanks to check & feedback.

Hi
the problem is that google signals these paginations as errors because it sees the same texts for all paginations.
so probably it is true that for different languages there are different canonical url because the content is different

for getCanonicalURL yes you can fix the problem here removing all code except
$canonicalUrl = $this->context->link->getCategoryLink($this->category);

the problem is that all these pages have the same meta title and meta description

another problem is that the canonical url is missing in many pages like for manufacturers, index, contact, discount page ....

@maofree,

another problem is that the canonical URL is missing in many pages like for manufacturers, index, contact, discount page

here is an issue previously reported #9503

it was created in 22 august
I think these types of issues should have a higher priority

@maofree,

the problem is that all these pages have the same meta title and meta description

for example, you can add different Meta title, Meta description for different languages
I attached a video record
https://drive.google.com/file/d/1fIEMIuDC86t1Ei5QIKVl3OKvJ42FZoaa/view
For the page n掳2, the title of the page is changed also
https://drive.google.com/file/d/17cP3B7VMPI0cf6vpsJ2suKwO5EVLS7rk/view
Thanks to check & feedback.

yes I know this so I think it is right to use different canonical url on each language
for example, you can add different Meta title, Meta description for different languages

@maofree, thanks for your feedback.
About the pagination,

the second page has a different canonical

the second page has a different meta title than the first page & different content => so we have different canonical, is it right?
Thanks!

no
the second page has the same meta title and meta description of the first page and the third page ...

the problem is present for all page with paginations

the multi language is another thing

@maofree,
Yes, the meta description is the same for different page.
But the title is different, as you can see in my screen-record
https://drive.google.com/file/d/17cP3B7VMPI0cf6vpsJ2suKwO5EVLS7rk/view
PS: For each paginated page, we have the rel next/prev.
Thanks!

Hello @maofree

I know it is complicated to have a unique/general point of view about SEO, so I'm aware what I'm saying may not be correct for every use cases. But in several best practices about managing pagination for SEO you can find that each page needs to be self canonical, which makes sense because the content is different (not the same products).

You can also have the same title and meta it will not be considered as duplicate content, however it is recommended to have more content in the first page in order to "highlight" it, that's why from 175 the category description is only displayed in the first page.

About language it is also advised to use the alternate rel link, each page can have its own canonical (different language => different content => different page), but the alternate link (with hreflang attribute) helps SEO engine to relate pages between each other.

However one thing we are indeed missing is the rel next/prev between each pages.. or at least in the header ^^ The rel links are indeed present in the pagination block, but we probably should emphasize this by adding them in the header as well.

This could be added in the 177 version, @colinegin wdyt?

hi @jolelievre
the problem is that Google alert everyone with its notifications that there are duplications on meta titles and meta descriptions.
for the description only in the first page I think it not solve the problem, normally it is enought the first page because it has all content to index on some keywords, the rest of paginations are necessary?

another problem that Google alert everyone is the missing tag for the microdata of the blocks present in the category pages, now request more data to be set

I think if these alert will be removed everybody will be happy, and it should be a plus point for Prestashop.

bye

Hi @maofree
we plan to discuss this topic to think about how it could be improved in 177 version
Do you have any suggestion on how/what we could do by any chance?

hi
I summarize the 4 points that I believe are a problem. At this moment Google reports errors with the current solutions used in prestashop 1.7.5.x

1)
Google alerts shopkeepers, because some microdata are missing in the product pages and in the pages with products lists like category pages, try to have a look with the google's tool
https://search.google.com/structured-data/testing-tool

2)
the pages with paginations give problems because Google alerts shopkeepers that there are duplications on meta title and meta descriptions. I think it is enought to use the first page to index the category page and use the url canonical to avoid duplications on meta data. Normally it is the first page that index those pages.

3)
only the category pages have url canonical the other paginations are without it, like for manufacturer page.
the url canonical can be useful also for the homepage or contact pages to protect them

4)
the other problem is that now each combination has own page, so if the site use comparators like google shopping visitors come on product page and it is necessary to give to them all informations without move it on many pages, all data should be present in the product pages to reduce the bounce frequency

bye

Hello @maofree ,

sorry for only writing back now and thanks for all your feedbacks. About your comment :

hi
1st issue #14558 uses the ItemList but it is a wrong solution, because it is not possible to have more than one ItemList in a page

4th issue in the 1.7 a product with combinations has a number of urls how many are its combinations. Normally each url show the images of the current combination, so if I'm a visitor I need to scroll each combination to see its images, I think it is better to can see all infos, data, images at the start

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sandra2n picture sandra2n  路  3Comments

Van-peterson picture Van-peterson  路  3Comments

hiousi picture hiousi  路  3Comments

khouloudbelguith picture khouloudbelguith  路  3Comments

zuk3975 picture zuk3975  路  3Comments