New Mediaist is an Internet marketing  consulting firm. We help industry-leading firms plan, develop, and grow their online presence.<br />
New Mediaist is in the business of helping companies focus on what counts.<br />
Our measurement focused-approach helps businesses target their online marketing activities, enabling for the further development of recurring revenue sources and sustainable competitive advantages.

Ari's blog

Hack to Add Meta Tags to Page Views in Drupal

The Drupal Nodewords Module is one of the most common ways of adding meta description information to the Drupal CMS. Unfortunately, it does not integrate with the Views module very well, making it difficult to generate appropriate meta descriptions on-the-fly based on views arguments.

One way I found to work around this issue is to use the views' header, along with the PHP Input format, to manually add in the meta information.

To do this, when creating the page view:
Under Basic Settings, select "Header" - input format PHP.
Type the following code in the header:

<?php
$view = views_get_current_view();
drupal_set_html_head('args[0].'" />');
?>

There you go - now you have dynamic meta descriptions in your drupal page view which includes the argument passed within the view. You can set the title tags for the view as well using a similar method, although that shouldn't be necessary as the title of the pageview will automatically flow out to the page title.

Syndicate content