I
I
Ivseti2022-02-15 13:52:49
opencart
Ivseti, 2022-02-15 13:52:49

How to set canonical URLs in Opencart?

How to set the canonical url of the main page on pagination pages. An example on the page https://moonk-design.com/magazin/?page=2 set up the canonical url https://moonk-design.com/magazin/

Can someone tell me?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivseti, 2022-02-16
@Ivseti

Found a solution on the git hub:
https://github.com/myopencart/ocStore/commit/cd170...
More details are described here: https://opencartforum.com/topic/174539-sposob-vyvo...

O
opencartbot, 2022-02-16
@opencartbot

Open the catalog\controller\product\category.php
file and find the line there

$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical');

replace it with this
$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical');

After that, update the modifier cache in the admin panel.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question