Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Tweeted twitter.com/#!/StackDrupal/status/216615499109371904
Source Link
B2F
  • 937
  • 8
  • 18

Addind a meta noindex tag within template.php

I would like to add a meta tag noindex from within the template.php file of my theme.

The purpose is to remove two nodes 404 error page from google's index, I would like to do it like so :

// in mytheme/template.php
function my_theme_preprocess_node(&$variables, $hook) {
   $node = $variables['node'] ;
   // '123' would be nid of the 404 presentation page
   if($node->nid == '123'){
   /* META NO INDEX CODE GOES HERE */

Is this possible to do in my theme, without using any module at all ?