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

Damien Tournoud’s picture

Status: Active » Closed (won't fix)

That's already there:

<meta name="Generator" content="Drupal 7 (http://drupal.org)" /> 
oriol_e9g’s picture

Status: Closed (won't fix) » Fixed

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)',
    ),
  );
oriol_e9g’s picture

Status: Fixed » Closed (fixed)
espirates’s picture

Status: Closed (fixed) » Active

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 ?

Mark Trapp’s picture

Status: Active » Closed (fixed)

The following should remove the element:


function mymodule_html_head_alter(&$elements) {
  unset($elements['system_meta_generator']);
}

klonos’s picture

Category: feature » support
Status: Closed (fixed) » Active

I have tried the code in #5 (minus the closing php tag and replaced the mymodule part 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_elements instead of &$elements and meta_generator instead of system_meta_generator to 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.

klonos’s picture

...the code in /includes/common.inc is:

  // 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)',
    ),
  );

So &$elements and system_meta_generator should 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.

Mark Trapp’s picture

Category: support » feature
Status: Active » Closed (fixed)

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).

klonos’s picture

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:

...sorry for hijacking this issue but I didn't want to file a duplicate/related.

I didn't want to file a separate issue simply to be pointed back to #5.

I also said:

I will revert category and status back to the previous once I get a reply.

Happy now?: #1904556: Cannot disable the "Generator" meta tag anymore through mytheme_html_head_alter