in Hacks, Joomla

Joomla 1.7 hack – replace the META GENERATOR tag

In Joomla 1.7, the system automatically creates a META Generator tag that you might want to change or hide.

The default tag looks like this:

<meta name="generator" content="Joomla! 1.7 - Open Source Content Management" />

There is no way within Joomla to change or remove this tag, so you have to put a little line of PHP in your template.

Edit your template and look for this line:

<jdoc:include type="head" />

Just above that line, paste in the following:

<?php $this->setMetaData('generator','my site'); ?>

The two lines together should look like this:

<?php $this->setMetaData('generator','my site'); ?>
<jdoc:include type="head" />

In the above code, substitute your custom generator tag value in place of the words my site.

Because this hack is in your template, you don’t have to worry about the next upgrade to Joomla overwriting hacked core files.

Thanks to gabha.net for showing the way.

(This tip was originally posted on June 18th, 2009 for Joomla 1.5, but this hack is tested and working for 1.7, so I’ve updated and reposted.)

Update 21 January 2012:

Looking at this post’s comments, some people seem to be having trouble. In the following example, I’m using the Joomla 1.7 default template Beez2 – Default to illustrate further.

Editing the HTML of Beez2 – Default, you will see on line 36 is the opening HTML <head> tag, then on line 37 is <jdoc:include type=”head” />

We’re going to insert a new PHP command between line 36 and 37 — between the <head> tag and the <jdoc:include type=”head” />

Copy the following code:

<?php $this->setMetaData('generator','my site'); ?>

Then paste this code into the Beez2 – Default template code between line 36 and 37. Your code should now look like this:

To customize this,  you will replace your own value for the ‘my site’ value. In my case, I use my domain name.

Now, save the template and upload. Switch to your web browser, reload the page, and view the source.

Viola!