Thursday, April 18, 2013

Joomla SEO meta tag recommendations



  1. In the Global settings area of Joomla’s administration panel, insure the fields Global Site Meta Description and Global Site Meta Keywords are empty.
  2. Change Joomla’s meta tag logic so that Joomla won’t needlessly insert empty tags in a page. The file islibraries/joomla/document/html/renderer/head.phpand the changes to make are in red. Technical folks may want to download a patch file for version 1.5.
    // Generate META tags (needs to happen as early as possible in the head) foreach ($document->_metaTags as $type => $tag) { foreach ($tag as $name => $content) {if($content != ''){ // only output tags if they actually have a value - Sean Carlos http://antezeta.com/ if ($type == 'http-equiv') { $strHtml .= $tab.'<meta http-equiv="'.$name.'" content="'.$content.'"'.$tagEnd.$lnEnd; } elseif ($type == 'standard') { // don't output <meta name="robots" content="index, follow" /> as this is too embarassing: its the default for search engines! - Sean Carlos http://antezeta.com/ if($name == 'robots' && $content == 'index, follow' ) { $content = 'index, follow'; // do nothing } else { $strHtml .= $tab.'<meta name="'.$name.'" content="'.str_replace('"',"'",$content).'"'.$tagEnd.$lnEnd; } } } } }$documentDescription = $document->getDescription(); if ($documentDescription) { // only output tags if they actually have a value - Sean Carlos http://antezeta.com/ $strHtml .= $tab.'<meta name="description" content="'.$document->getDescription().'" />'.$lnEnd; }if($document->getGenerator() != '') { // only output tags if they actually have a value - Sean Carlos http://antezeta.com/ $strHtml .= $tab.'<meta name="generator" content="'.$document->getGenerator().'" />'.$lnEnd; }
    In version 1.6, it isn’t necessary to change the logic which sets the meta description which has already been fixed.
  3. To remove the meta generator tag, it is necessary to add a line of code to the main template file, such astemplates/rhuk_milkyway/index.php
    <head> <?php $this->setMetaData('generator',''); ?> <jdoc:include type="head" />
Unfortunately these changes need to be reapplied should the Joomla software and/or theme be updated.

1 comment: