Tag: generator tag

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

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

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

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

We can set a option in template

in template index.php file

<?php
 	  $myconfig = new JConfig();
	  $mysitename = $myconfig->sitename;
 ?>
 <?php
 if($this->params->get('removegeneratortag') == "yes"):
	// Remove the generator meta tag
	$this->setGenerator($mysitename);
endif;
 ?>

in params.ini file add extra line
removegeneratortag=yes

in templateDetails.xml file

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

before

"</install>"'

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