Add meta tags to a Drupal 7 view without adding or writing a module

Add the following PHP code to a new Header or Footer element in the View.

$element = array(
  '#tag' => 'meta',
  '#attributes' => array( // Set up an array of attributes inside the tag
    'name' => 'description',
    'content' => 'Your view description.',
  ),
);
drupal_add_html_head($element, 'yourviewname_meta_desc');
?>

Comments