2

I need to add rel=canonical meta tags to some views. There are a couple of sandbox modules for the metatag module but I'm looking for a more simple solution.

Couldn't I just use views_php and drupal_add_html_head()?

2

Try the Context Metadata module. It can add metadata to node and non-node pages. The following metadata tags can be set according to a context: Title, Description, Keywords and Canonical URL.

2

The Meta tags quick project helps you to assign meta tags basing on the page path. This may be useful to you.

0

If you want to add meta tags to a view without adding or writing a module, you could just do this. Add a block with the following PHP code and set the block visibility that view only.

<?php
$element = array(
  '#tag' => 'meta', // The #tag is the html tag - <link />
  '#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');
?>

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.