Adding robots meta-tag to a CakePHP view

Here’s a little how-to I discovered a few months ago while I was working on and realized that Google was indexing a whole lot of mostly blank pages.

To solve this, I figured I’d better put a no-index on those pages fast; after mucking around with CakePHP’s html->meta handler (because I wanted the meta tag in the header where it belonged) and not finding anything, I came up with:

  1. $html->meta('robots', null, array('name' => 'robots', 'content' => 'noindex') ,false);

BTW: The pages where empty at the time because there wasn’t a lot of data in the system, so a lot of searches where coming up empty- that’s been “fixed” now too.

Hopefully this saves someone else 20 minutes :)