How To Remove Drupal Meta Generator Tag

Drupal adds a Generator meta tag in head section to track and declare that this site runs Drupal. Sometime it cause security issue by exposing your CMS/platform information. If you want to remove this META from your drupal, here is a tutorial for this.

Like most other CMS on the web, Drupal leave it’s footprint called meta generator tag on your site’s source code for the purpose of tracking. The meta generator code placed in your site’s head section. The generator code is:

<meta name="generator" content="Drupal 7 (http://drupal.org)" />

Unfortunately, This footprint help hackers to identify your CMS/platform that makes it easy for them to tryout their best attacking method for your platform. There’s a couple of reasons user wants to hide or even completely remove the meta generator tag from their site’s source code that is generated by Drupal.

Here in this article, I’ll show you how to completely remove meta generator tag from your Drupal site’s source code.

Method 1: Using Drupal Contributed module (Recommended for Beginners)

There’s some module available on Drupal’s module project that will help you in removing or hiding Drupal meta generator tag from your site’s source code. There’s a module named Remove Generator META tag(https://www.drupal.org/project/remove_generator) is pretty good for this task.

This module coded only for this job and you don’t even need to do anything with this module. All you have to do is, Install and activate Remove Generator META tag on your drupal installation and the meta generator will gone.

You can also restore the meta generator tag by disabling this module. The same can also be done using drupal Metatag module (may have already installed). If you already have Metatag module installed, I recommend you to use this instead any other module. To remove drupal meta generator using Metatag module, follow the instructions below:

Step 1: Go to Configuration > Search and metadata > Metatag

Remove Meta Generator Drupal Metatag Module Step 1

Step 2: Click on Override/Edit operation for Global type

Remove generator meta drupal using metatag step 2

Step 3: Now click on the ADVANCED TAGS to expand settings then empty the Generator field content

Drupal Metatag module generator Field

Click on the Save button to apply the setting. Now the Meta generator removed from your Drupal installation.

Method 2: Using template.php File

You can also remove the drupal meta generator from head section using template.php file. All you have to do is, put the code below to your active theme’s template.php file:

<?php
function YOUR_THEME_NAME_html_head_alter(&$head_elements) {
  unset($head_elements['system_meta_generator']);
}

Note: Make sure to replace YOUR_THEME_NAME with your active theme name.

that’s it.

Hope this tutorial help you to remove Drupal meta generator tag from your site. Do you know any other method for removing meta generator in Drupal? Let us know using the comments below.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive website improvement tips and tutorials.

 

We'll periodically send useful information, tips & tutorials to improve your website performance, conversion optimization, SEO and design tweaks to make your website better.

Thank you for signing up!

Please check your email and click the link provided to confirm your subscription.

Powered by Rapidology
No Comments

Post a Comment