You are here

function no_index_init in Util 7

Same name and namespace in other branches
  1. 6.3 contribs/no_index/no_index.module \no_index_init()

Implements hook_init().

File

contribs/no_index/no_index.module, line 40
Prevent search indexing. Adding a robots header isn't necessarily a sure thing. It's not supported by all search engines and will not guarantee your site will be excluded. Read:…

Code

function no_index_init() {
  if (variable_get('no_index_setting', 0)) {
    $data = array(
      '#tag' => 'meta',
      '#attributes' => array(
        'name' => 'robots',
        'content' => 'noindex, nofollow',
      ),
    );
    drupal_add_html_head($data, 'no_index_meta');
  }
}