Posted by oriol_e9g on June 23, 2010 at 9:17am
5 followers
Jump to:
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | theme system |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I think that could be a good thing add the meta generator in the drupal core themes.
<meta name="generator" content="Drupal 7" /> We can indicate de major version, but not the subversion to prevent the easy reveal potential vulnerabilities in outdated sites.
Comments
#1
That's already there:
<meta name="Generator" content="Drupal 7 (http://drupal.org)" />#2
Ops!! This is now added in Drupal 7
// Show Drupal and the major version number in the META GENERATOR tag.// Get the major version.
list($version, ) = explode('.', VERSION);
$elements['system_meta_generator'] = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'Generator',
'content' => 'Drupal ' . $version . ' (http://drupal.org)',
),
);
#3
#4
How to remove the meta generator in Drupal 7 ? I don't want it and I suspect many won't either or should a module be made to remove it ?
#5
The following should remove the element:
<?phpfunction mymodule_html_head_alter(&$elements) {
unset($elements['system_meta_generator']);
}
?>
#6
I have tried the code in #5 (minus the closing php tag and replaced the
mymodulepart with my theme's actual name) in my theme's template.php in latest D7 dev and it simply won't do magic any more :/I have also tried various other flavors suggested around d.o and elsewhere over the internet like using
&$head_elementsinstead of&$elementsandmeta_generatorinstead ofsystem_meta_generatorto no avail. Am I doing something wrong or did something perhaps change in core in the meantime?PS: sorry for hijacking this issue but I didn't want to file a duplicate/related. I will revert category and status back to the previous once I get a reply. Thanx beforehand.
#7
...the code in /includes/common.inc is:
<?php// Show Drupal and the major version number in the META GENERATOR tag.
// Get the major version.
list($version, ) = explode('.', VERSION);
$elements['system_meta_generator'] = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'Generator',
'content' => 'Drupal ' . $version . ' (<a href="http://drupal.org" title="http://drupal.org" rel="nofollow">http://drupal.org</a>)',
),
);
?>
So
&$elementsandsystem_meta_generatorshould be the ones to work (in theory at least).PS: the http://drupal.org part in the above code snippet should not be converted btw. There must be something wrong with the text filter.
#8
Please don't hijack issues like this. The correct course of action is to indeed create a new support request (or, alternatively, ask on Drupal Answers or utilize any of the other support options).
#9
Mark, you are right but you need to chill. I've been around d.o long enough to know how things work, but as I said:
I didn't want to file a separate issue simply to be pointed back to #5.
I also said:
Happy now?: #1904556: Cannot disable the "Generator" meta tag anymore through mytheme_html_head_alter