How to add a META tag in head conditionally to entity content I need to put a meta NOINDEX tag in head conditionally to a CCK field value ("visibility=private") in one specific content type ("projects").

I read about drupal_add_html_head($data = NULL, $key = NULL) but I'm not sure where to put it.

If I could put the tag in body I would just use a computed_field, but as I need it to be in head, should I put it on my own module (but on which hook?) or should I copy/insert it  in html.tpl.php ?

My problems are (a) that if html.tpl.php will change then I'll have to change also the copy I overridden; (b) then I'm also not sure I have access to $entity inside the template (I never used them) and, finally, (c) that being a matter of logic rather than presentation a module maybe is more indicated than a template.
For all this reasons I would prefer a custom module. Would it be possible ?
It's definitely possible, you could do this using hook_entity_view() for example:

function MYMODULE_entity_view($entity, $type, $view_mode, $langcode) {
  if ($type == 'my_entity_type' &amp;&amp; $view_mode == 'some_view_mode') {
    // Check the field items.
    if ($items = field_get_items('my_entity_type', $entity, 'field_visibility')) {
      if ($items[0]['value'] == 'private') {
        $element = array(
          '#tag' =&gt; 'meta',
          '#attributes' =&gt; array(
            'name' =&gt; 'robots',
            'content' =&gt; 'noindex',
          ),
        );
        drupal_add_html_head($element, 'robots');
      }
    }
  }
}