0

Im using D7 and views 3 and I cant seem to find a solid answer on how to do this or if its possible but I created a page in views and I wanted to no-index the page, I dont see any options in views to do it so im wondering if this is possible and if so how can I go about doing this.

Any help is appreciated it.

EDIT**

Here is a function I managed to come up with however it something is making it not work. Does anyone have any suggestions?

function noindex_taxonomy(&$head_elements) {
  if (arg(0) == 'taxonomy' && arg(2) == 104 || arg(0) == 'taxonomy' && arg(2) == 103 || arg(0) == 'taxonomy' && arg(2) == 108) {
    $head_elements['noindex'] = array(
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => array(
        'name' => 'robots',
        'content' => 'noindex',
      ),
    );
  }
}
1

There is not any option in views module to add metatags. but you can add metatags to any url of your site by other drupal metatag modules. See How to define Meta tags on Views?.

1
  • Yeah I tried using that but its throwing off errors on my site. Feb 9 '12 at 23:45
0

I was able to achiveve this by putting my function into my template.tpl.php file

function loans_html_head_alter(&$head_elements) {

/*Url inside the view*/ $siteurls = drupal_get_path_alias();

if (arg(0)== 'taxonomy' && $siteurls == 'taxonomy/term/104/latest') {
    $head_elements['noindex'] = array(
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => array(
        'name' => 'robots',
        'content' => 'noindex',
      ),
    );
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.