Removing META name=title tag in Symfony for SEO
Posted by sumedhinamdar on July 20, 2008
A little technical tip for people who use Symfony framework…
The <?php include_metas() ?> call in Symfony includes META tags…there is a tag <META name=”title” in it…which is not the real Title tag…
From SEO perspective, this META tag might be dangerous, and is certainly useless…Google might think of your site as it’s repeating keywords too much…though I am not sure about this…may be I’ll post an update on this based on my experience…
There is no straightforward way to remove it…but I found a great way with the help of some great hackers on Symfony google group…
Basically, you need to write a class overriding the default sfWebResponse class…and unset the META name=title tag in it…like this:
class myWebResponse extends sfWebResponse
{
public function getMetas()
{
$meta_tags = $this->getParameterHolder()->getAll(’helper/asset/auto/meta’);
//find mata title tag and if find then reset to blank.
if (array_key_exists(’title’, $meta_tags))
{
unset($meta_tags['title']);
}
return $meta_tags;
}
}?>
Now, you just need to modify your factories.yml file to use this class instead of default sfWebResponse class, and you are done!
I thought this problem would be faced by other people…so posted quickly…
Possibly related posts: (automatically generated)
This entry was posted on July 20, 2008 at 6:47 am and is filed under META tags. Tagged: META tags, Symfony, Title tag. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

November 6, 2008 at 7:04 pm
Thanks! This pointed me in the right direction…I ended up using a slightly different solution.