Issues

ZF-7733: Cannot set "rel" attribute for links on Zend_Navigation_Page

Description

I am using Zend_Navigation to render a navigation menu on a website. Some of the links in the menu require the rel="nofollow" attribute to be set on the tag because we do not want search engines like Google crawling to those pages.

The problem is that Zend_Navigation_Page has a setRel() and getRel() method, which is used to store "Forward links to other pages".

I thought I could just do this: $page=>setOptions(array('rel'=>'nofollow'))

Hoping it would put that into $_properties['rel']

But because the toArray() method merges the customProperties BEFORE the standard properties, my value for 'rel' is overwritten by the rel array.

Is there any way to set the rel="nofollow" attribute on the tag using Zend_Navigation? Thanks

Comments

The 'rel' and 'rev' properties of the page class is currently only being used by Zend_View_Helper_Navigation_Links, which is not of any help for your use case.

There is no way in the framework for specifying rel="nofollow" in menus, and I'm afraid such a feature might fall outside the 80/20 rule.

You could achieve this quite easily yourself, though, by extending the menu helper and check for a $page->noFollow attribute etc.