4

In category page, I need to show link tags that holds pagination's previous and next links like below:

<link rel="prev" href="http://www.test.com/prod1.html?p=1" />
<link rel="next" href="http://www.test.com/prod1.html?p=3" />

Did some research but no success yet.

I have used head as reference in layout but the problem is, page head content gets loaded before category product collection is loaded because if which total number of products cannot be found.

Please suggest!

Thank you in advance!

4

Try installing this module: https://github.com/drewhunter/SeoPagination

the idea is to listen to this event:

controller_action_layout_render_before_catalog_category_view

then create your own pager block, assign current product collection and page limit to it so that you have a functional pager that can give you the links to next, previous and current page. Finally you can inject them into the head block like this:

$headBlock = Mage::app()->getLayout()->getBlock('head');
$headBlock->addLinkRel('prev', $nextPageUrl);
$headBlock->addLinkRel('next', $prevPageUrl);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.