Hi,

I have build a variable panel. See for example: www.gratis-informatie.nl/over/kerst/nederland
The panel is filled related to the two terms after /over/
Say /over/foo/bar .

The foo/bar triggers arguments in views and other modules.
Is it possible to set the Metatags (Nodewords module or custom) related to the nodes which are shown.
Say the meta tag title is the first title in the shown node in the view?
Say the meta tag description is the first body of the shown node in the view?

Is this possible?
Please help.

Thanks in advance!

greetings,
Martijn

Comments

summit’s picture

Hi,

I found a little snippet what may be can help.
Placing this in the views argument handling code works:
the $tmpterms_x[0] is a variable which holds the argument[x]

..
drupal_set_html_head('<title>'. $tmpterms_0[0]->name . '</title>');
drupal_set_html_head('<meta name="description" content="' . $tmpterms_0[0]->name . '" 
/>');
drupal_set_html_head('<meta name="keywords" content="' . $tmpterms_1[0]->name . '" />'); 
etc..

Does anybody use this sort of code to get the meta-description and meta-keywords programmatically filled?
Ok, now I need to erase the by nodewords set meta description and keywords for this specific view/panel.
I can do this in the theme in page.tpl.php with:

<?php
  if (arg(0) == 'view' && arg(1) == 'some-list') {
    $head = preg_replace('/"to be replaced string"/', '"replaced string"', $head);
  }
  print $head
?>

But I think this is inefficient, right?

Is there a way to -not-set- the nodewords for a particular page, as is possible with other items like nodes within Drupal. Does anybody have a patch for this?

Thanks for your reply!

greetings,
Martijn

avpaderno’s picture

Status: Active » Closed (won't fix)

As the Drupal 5 version is not supported anymore, I am changing the status of this report.