Adding custom generator tag in joomla

Joomla creates a generator meta tag automatically. If you view source of your joomla site you can search for meta tag “generator”. The default generator tag looks like
[code]
<meta name="generator" content="Joomla! 1.5 – Open Source Content Management" />
[/code]
We can modify this generator tag and also can put option in our custom joomla template to change this meta tag to site name or something different. so let’s start 🙂

In you template index’s file header tag you can write a line like bellow

[code language=”php”]
<?php
$this->setGenerator("your custom generator name");
$this->setGenerator(""); // you can leave that as blank too
?>
[/code]

We can set a option in template

in template index.php file

[code language=”php”]
<?php
$myconfig = new JConfig();
$mysitename = $myconfig->sitename;
?>
<?php
if($this->params->get(‘removegeneratortag’) == "yes"):
// Remove the generator meta tag
$this->setGenerator($mysitename);
endif;
?>
[/code]

in params.ini file add extra line
removegeneratortag=yes

in templateDetails.xml file

[code language=”xml”]
<params>
<param name="removegeneratortag" type="list" default="yes" label="Remove Joomla Generator Tag" description="Remove or disable joomla generator tag from head tag for security reason">
<option value="yes">Yes</option>
<option value="no">No</option>
</param>
</params>
[/code]

before

[code]"</install>"'[/code]

tag

you are done. I think now you can add/customize in your own way as you need. If you don’t know how to modify the above code then don’t try 😛

Thank you