Add Meta Tags to Views
Update (May 17, 2013): The patch mentioned below has been committed, so this Views PHP solution is no longer necessary.
Add meta tags to views in Drupal by using the 'Views PHP' module and the drupal_add_html_head function.
Meta Tags is an excellent Drupal module for managing meta tags, however, it doesn't yet allow adding meta tags to views. There is an open issue on this topic: http://drupal.org/node/1804356. While code had been offered in the form of a patch, it still has some issues.
In the interim, Views PHP offers a solution for this issue by way of the drupal_add_html_head function.
My use case is to prevent search engines from indexing certain Views pages.
- Install and enable Views PHP.
- Add a 'Global: PHP' element to the View header.
- Insert the code below, customized for your use:
Comments
Marc (not verified)
Wed, 12/17/2014 - 04:52
Permalink
seems not to be cahcable
I tried exactly this example. As long caching is disabled, this works fine ...
Add new comment