• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1912
  • Last Modified:

How do I add a <Link rel="canonical" tag to the head of a page from an Action in Zend Framework?

Hi there,
Im using the full Zend framework stack on a website with MVC and all that gubbins. I have an action that does some task, but it has a number of routes into it. I want to insert a tag like this into the head from that action:
<link href="http://myurl.com/action/id/1" rel="canonical" />

I know how to set headers but that seems to only be for meta tags. How do I insert a link?

  • 2
1 Solution
SlimshaneeyAuthor Commented:
Answered my own question!

 $this->view->headLink()->headlink(array('rel' => 'canonical', 'href' => 'http://myurl.com/canonical'), 'PREPEND');

Open in new window

SlimshaneeyAuthor Commented:
Answered it myself!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now