1

I have recently discovered via google webmaster tools that I have over 900 duplicate meta descriptions. After some digging around, I found out that when you leave a meta description blank, Magento fills it with the product description.

In most cases this probably makes sense to do. However, in my store, I have a huge selection of a type of product that is almost exactly the same except for maybe a color or a slightly modified wording. Because of this I intentionally left the meta descriptions blank since it is simply not an option to write unique meta desc tags for all these products.

So with magento auto filling these with the product descriptions which are duplicate, it is causing a big problem. Is there a way to stop magento from auto-filling. If not, the next best option would be to remove the meta description tag altogether on product pages only.

Any ideas?

1 Answer 1

2

You can rewrite the Mage_Catalog_Block_Product_View block and change the method _prepareLayout. That is where the meta description is set.

You need to change this:

        $description = $product->getMetaDescription();
        if ($description) {
            $headBlock->setDescription( ($description) );
        } else {
            $headBlock->setDescription(Mage::helper('core/string')->substr($product->getDescription(), 0, 255));
        }

Into this

$description = $product->getMetaDescription();
$headBlock->setDescription( ($description) );
2
  • Thank you! That worked perfect. It's a shame to have to edit the core though. It should really be an option in admin since in some cases the default behavior is damaging to seo.
    – markf
    Commented Mar 4, 2014 at 16:03
  • @markf. Oh no...please don't edit the core. Rewrite the class. See this for more details: magedev.com/2009/06/03/magento-overriding-model-block-or-helper
    – Marius
    Commented Mar 4, 2014 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.