Page 1 of 1

Pagination links rel "attribute"

Posted: Fri Sep 16, 2011 9:50 pm
by dony_b
Is is possible to add rel "attribute" to the pagination links so if Im on the first page the second link has a rel "next" and on second page the previous links has rel "prev"

I looked into controller/category.php - Is this where I can do this ?

Code: Select all

$pagination = new Pagination();
	$pagination->total = $product_total;
	$pagination->page = $page;
	$pagination->limit = $limit;
	$pagination->text = $this->language->get('text_pagination');
	$pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}');
	
			$this->data['pagination'] = $pagination->render();

Re: Pagination links rel "attribute"

Posted: Tue Feb 21, 2012 9:06 am
by Lisaweb
I would appreciate an answer to this as well. Anyone?

Re: Pagination links rel "attribute"

Posted: Tue Feb 21, 2012 7:20 pm
by Avvici
This actually is already in place with OC's pagination. There already is a < for previous and a > for next with a box around it. You would simply change those to the strings "Next and Previous" :)

Re: Pagination links rel "attribute"

Posted: Tue Feb 21, 2012 10:09 pm
by Lisaweb
Thank you! :-)

Re: Pagination links rel "attribute"

Posted: Fri Apr 20, 2012 12:40 am
by stonehinged
dony_b, are you attempting to add the next/prev "rel" attributes to each of the category pages? If so this has to be injected within the <head> tags and I suppose would need to be written as a condition to dynamically determine which page you are on. Sure wish I knew how to do it!

I was reading up a bit on this: http://googlewebmastercentral.blogspot. ... lprev.html

Sounded like this might be what you are after... to indicate the relationship between component URLs in a paginated series.

Re: Pagination links rel "attribute"

Posted: Fri Apr 20, 2012 9:58 pm
by dony_b
go to /system/library/pagination.php

Look for this occurrences

Code: Select all

 <a href="' . str_replace('{page}', $i, $this->url) . '">'

Re: Pagination links rel "attribute"

Posted: Sat Apr 21, 2012 3:08 am
by stonehinged
That's what my initial thoughts were but that doesn't encode the <head> tag on each page. What I'm after isn't for anchor tags, but instead page link tags.

The coding would need to render page link tags in the <head> like the following:

On the first page, http://www.example.com/article?story=abc&page=1, you’d include in the <head> section:
<link rel="next" href="http://www.example.com/article?story=abc&page=2" />

On the second page, http://www.example.com/article?story=abc&page=2:
<link rel="prev" href="http://www.example.com/article?story=abc&page=1" />
<link rel="next" href="http://www.example.com/article?story=abc&page=3" />

On the third page, http://www.example.com/article?story=abc&page=3:
<link rel="prev" href="http://www.example.com/article?story=abc&page=2" />
<link rel="next" href="http://www.example.com/article?story=abc&page=4" />

And on the last page, http://www.example.com/article?story=abc&page=4:
<link rel="prev" href="http://www.example.com/article?story=abc&page=3" />

Unfortunately way beyond my skill set!

Re: Pagination links rel "attribute"

Posted: Tue May 22, 2012 10:31 am
by voodoo
Hey stonehinged, I just made a mod for this !

http://www.opencart.com/index.php?route ... on_id=6542

Re: Pagination links rel "attribute"

Posted: Fri May 25, 2012 4:02 am
by stonehinged
Nice! So does it handle all the conditions stated above? And this definitely adds the various link rels within the <head> tag? Sweet if so!