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) );
Of course, you can restrict your review pages from indexation. That can be done by removing links to this page and moving the reviews list to the main product pages. This is the way most of users who have a custom theme choose.
However, a better alternative to this 'standard' solution would be changing meta descriptions and meta titles for your reviews page.
Just copy this: /app/code/core/Mage/Page/Block/Html/Head.php
to: /app/code/local/Mage/Page/Block/Html/Head.php
and modify (the example for meta titles and meta description will be the same):
from:
public function getTitle()
{
if (empty($this->_data['title'])) {
$this->_data['title'] = $this->getDefaultTitle();
}
return htmlspecialchars(html_entity_decode(trim($this->_data['title']), ENT_QUOTES, 'UTF-8'));
}
to
public function getTitle()
{
if (empty($this->_data['title'])) {
$this->_data['title'] = $this->getDefaultTitle();
}
///Added 'Review for' for title
if ($this->_getCurrentFullActionName() == 'review_product_list') {
$this->_data['title'] = $this->__('Reviews for') . ' ' . $this->_data['title'];
}
///
return htmlspecialchars(html_entity_decode(trim($this->_data['title']), ENT_QUOTES, 'UTF-8'));
}
protected function _getCurrentFullActionName()
{
$controller = Mage::app()->getFrontController();
if(is_object($controller) && is_callable(array($controller, 'getAction'))){
$action = $controller->getAction();
if(is_object($action) && is_callable(array($action, 'getFullActionName'))){
$actionName = $action->getFullActionName();
if($actionName) return $actionName;
}
}
return null;
}
This and other problems, for example, not friendly URLs for review pages or duplicate content in different categories:
http://clients-sherodesigns.com/newstore/review/product/list/id/456/category/17/
http://clients-sherodesigns.com/newstore/review/product/list/id/456/
can be solved by using MageWorx SEO Suite Ultimate - the software will correct all the issues with URLs and duplicate content:
http://clients-sherodesigns.com/newstore/khaki-bowery-chino-pants/reviews
Best Answer
The Meta Description for each page is loaded in the file
By default the code which renders the Meta Description looks like this
So first check for possible changes in this code.
Now for product pages the
getDescription()
function call gets its data fromBy default the
_prepareLayout()
function in this file should contain the following code for retreiving the Meta DescriptionSo also check this code for any changes. This code could also be overwritten in
If you do not find any changes then this may be caused by some extenion. A good way to trouble shoot is to disable all extensions (one by one) and/or change to the base/default theme to see what happens.