Запрет на индексацию определенной страницы или ноды

  1. function mytheme_preprocess_page(&$variables) {
  2. if ($path == 'path') {
  3. $element = array(
  4. '#tag' => 'meta',
  5. '#attributes' => array(
  6. 'name' => 'robots',
  7. 'content' => 'noindex',
  8. ),
  9. );
  10. drupal_add_html_head($element, 'mytheme_noindex');
  11. }
  12. }
  1. function mytheme_preprocess_node(&$variables, $hook) {
  2. $node = $variables['node'] ;
  3. if ($node->nid == '123') {
  4. $element = array(
  5. '#tag' => 'meta',
  6. '#attributes' => array(
  7. 'name' => 'robots',
  8. 'content' => 'noindex',
  9. ),
  10. );
  11. drupal_add_html_head($element, 'mytheme_noindex');
  12. }
  13. }
Russian
Категория: 
The code has been tested and works
Мультитег: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Target Image