The Missing Title Tags
Magento’s dynamic menu which is produced to allow navigation through the categories has a major flaw which could be so easily addressed, and it effects the overall SEO of the site. If Magento wants to continue to claim to be the best optimised shopping cart out there, it needs to make sure all areas are covered. This simple hack will add the all important title tags to your category menu.
Open the following file:
app > code > core > Mage > Catalog > Block > Navigation.php
The code that we need to edit resides in two places and is identical in both cases. At about line 186 and 254 there’s a line of code that looks like this:
$html.= '<a href="'.$this->getCategoryUrl($category).'"><span>'.$this->htmlEscape($category->getName()).'</span></a>'."\n";
You can see that it is simply a link inside a list item (if you look at the surrounding code), so let’s add our title tag in and use the Category Name as the title text:
title="'.$this->htmlEscape($category->getName()).'"
Added into the code you should end up with something that looks like this:
$html.= '<a href="'.$this->getCategoryUrl($category).'" title="'.$this->htmlEscape($category->getName()).'"><span>'.$this->htmlEscape($category->getName()).'</span></a>'."\n";
You may need to refresh your cache before seeing the changes take place, but this is really all there is to it. Come on Varien, let’s have it there by default in 1.4.0.2!
