In this previous blog entry you learned how to modify the node title itself. Here's how you can, for example for SEO purpose, modify the HTML page title of a node. You may for example add prefix or suffix text:
function YOURMODULE_node_view($node, $view_mode, $langcode) { if ($view_mode != 'full') {// Do NOT override embedded nodes!
return;}
$wrapper = entity_metadata_wrapper('node', $node); switch ($node->type) { case 'YOUR-NODE-TYPE-MACHIE-NAME': _YOURMODULE_set_title($wrapper->fieldxyz->value() . ' STATIC TEXT ' . $node->title); break;}
}
/**
* Helper function to set the current page title.
**/
function _YOURMODULE_set_title($title) { $maxLength = 120; if(is_string($title) && count($title) > $maxLength){ substr($title, 0, strrpos(substr($title, 0, 120), ' ')); drupal_set_title(trim($title, " \n\r\t\v\0&-,;:"));}
}
hook_node_view and drupal_set_title do the trick for you :)