I am new in using the zend framework. I have searched but didn't get a solution on how to create canonical links using zend framework 1.
The rel
attribute of the link
element should have canonical
, next
and previous
depending on the page you are on.
E.g When on this page (www[dot]example.co.uk/index/testimonials/), the link should be:
<link rel="canonical" href="http://www.example.co.uk/index/testimonials/”/>
<link rel="next" href="http://www.example.co.uk/index/testimonials/page/2”/>
I have done it a different way in my view/script file;
$this->headLink(array('rel' => 'canonical', 'href' => 'http://www.example.com/index/news?page=1'));
if ($this->page < count($this->newsList)){
$this->headLink(array('rel' => 'next', 'href' => 'http://www.example.comk/index/news?page='.($this->page + 1)));
}
if ($this->page > 1) {
$this->headLink(array('rel' => 'prev', 'href' => 'http://www.www.example.com/index/news?page='.($this->page - 1)));
}