Skip to content

Instantly share code, notes, and snippets.

@gwarnants
Created August 5, 2016 08:43
Show Gist options
  • Save gwarnants/0fc906d170e15188688d4182f096fdfd to your computer and use it in GitHub Desktop.
Save gwarnants/0fc906d170e15188688d4182f096fdfd to your computer and use it in GitHub Desktop.
Disable pages indexation in Drupal (meta robots=noindex)
<?php
/**
* Implements hook_preprocess_html().
*/
function <theme>_preprocess_html(&$vars)
{
$meta = array(
'#tag' => 'meta',
'#attributes' => array(
'name' => 'robots',
'content' => 'noindex, nofollow',
),
);
drupal_add_html_head($meta, 'robots');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment