You are here

function node_noindex_node_view in Node Noindex 7

Implements hook_node_view().

File

./node_noindex.module, line 52

Code

function node_noindex_node_view($node, $view_mode = 'full') {

  // Make sure we are on the node page.
  if (isset($node->noindex) && $node->noindex && $view_mode == 'full' && ($node_mgo = menu_get_object()) && $node->nid == $node_mgo->nid) {
    $element = array(
      '#tag' => 'meta',
      '#attributes' => array(
        'name' => 'robots',
        'content' => 'noindex',
      ),
    );
    drupal_add_html_head($element, 'node_noindex');
  }
}