Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Where is the $head defined in this theme? Is it pulling info from a function?
If you want to add meta data, is this what you would adjust/add to?
Comments
Comment #1
andrewmacpherson CreditAttribution: andrewmacpherson commentedThe $head variable is produced by the core drupal theme layer, in
includes/theme.inc
(line 1807 for drupal-6.16)Modules and themes can modify theme variables such as $head using theme hooks:
MODULENAME_preprocess_page(&$variables)
THEMENAME__preprocess_page(&$variables)
Adaptivetheme itself doesn't modify the $head variable, but modules like Book do. You can implement a preprocess_page() function yourself in a subtheme or module.
For an example of how to add extra <link /> elements, see my Touch Icons module (
touch_icons.module
, line 388):http://drupalcode.org/viewvc/drupal/contributions/modules/touch_icons/to...
Adding a <meta /> element can be done in a similar way. Note that the $variables array is passed by reference, so be careful not to over-write what is already there from other modules.
Comment #2
scotthoff CreditAttribution: scotthoff commentedThanks a lot. I don't really know what I am doing with this pre process variables. I am going to some research on what you are saying.
Comment #3
scotthoff CreditAttribution: scotthoff commentedWith the following code, I was able to add some text inside of $head, however, I was not sure if it overwrote what should have shown with nodewords.
Here is the code that I wrote to test...
Comment #4
halcyonCorsair CreditAttribution: halcyonCorsair commentedYou can also call drupal_set_html_head() in places like MODULENAME_init().
ie. drupal_set_html_head('');
Comment #5
scotthoff CreditAttribution: scotthoff commentedWould that overwrite existing head text?
Comment #6
halcyonCorsair CreditAttribution: halcyonCorsair commentedNo, it adds, see http://api.drupal.org/api/function/drupal_set_html_head/6
Comment #7
Jeff Burnz CreditAttribution: Jeff Burnz commentedCleaning up the issue queue.