ceberlin 284 Posted December 11, 2013 Google wants special code in the header to identify pages with a paginator correctly: <link rel="prev" href="http://www.example.com/article?page=1" /><link rel="next" href="http://www.example.com/article?page=3" /> Is there a way to do that with the paginator module already - or with some small tweaks? All the needed information should be there already (like "is there a next/prev page" and "what are the links") and there might be just some additional rendering for the header part of the webpage necessary. Source/read more: http://googlewebmastercentral.blogspot.de/2011/09/pagination-with-relnext-and-relprev.html Share this post Link to post Share on other sites
Philipp 504 Posted December 11, 2013 Couldn't you just use the current page number and generate the URLs according to this? $input->pageNum gives you the current page. Example: $nextURL = $config->httpHost . "page-" . $input->pageNum + 1; Of course, you would need to deal with the last and first page. Share this post Link to post Share on other sites
teppo 5,475 Posted December 11, 2013 Philipp is right -- this is roughly the logic I used a while ago: if ($input->pageNum) { $limit = 15; // whatever limit you're actually using if ($input->pageNum > 1) { echo "<link rel='prev' href='{$page->url}{$config->pageNumUrlPrefix}".($input->pageNum-1)."' />"; } if ($input->pageNum * $limit < $items->getTotal()) { echo "<link rel='next' href='{$page->url}{$config->pageNumUrlPrefix}".($input->pageNum+1)."' />"; } } 3 Share this post Link to post Share on other sites
ceberlin 284 Posted December 11, 2013 I see... I need to calculate the loop earlier (in the head already) and then have the info I need ... Here is my code in case s.o. wants to play with it further:I am trying this now within the page's head: $limit = 12; // the "limit"-setting used on this page $children = $page->children("limit=" . $limit); $totalpages = ceil($children->getTotal() / $limit); // PAGINATOR: set SEO tags for Google if ($input->pageNum) { if ($input->pageNum < $totalpages) { echo "<link rel='next' href='" . $page->url . $config->pageNumUrlPrefix . ($input->pageNum + 1) . "' />"; } if ($input->pageNum > 1) { echo "<link rel='prev' href='" . $page->url . $config->pageNumUrlPrefix . ($input->pageNum - 1) . "' />"; } } Within the body comes the loop and the paginator: <?php foreach($children as $child): ?> ... <?php endforeach; ?> <?=$children->renderPager(); ?> Share this post Link to post Share on other sites
Soma 6,628 Posted December 11, 2013 This would give you a pager without enabling PageNumbers on template, thus using /?page=2 instead of /page2 $pageNum = $input->get->page ? $input->get->page - 1 : 0; $limit = 5; $start = $pageNum * $limit; $result = $page->children("start=$start, limit=$limit"); echo $result->renderPager(); foreach($result as $p) echo "<p>$p->url</p>"; echo $result->renderPager(); 4 Share this post Link to post Share on other sites