100% Satisfaction Guaranteed. Click here to read why you should by from us.

SEO Tip - Changing Magento Product Review Page Titles


Out of the box, Magento doesn't set a page title for individual product review pages. This results in a missed SEO opportunity and many duplicate titles.

Here is a quick way to set the page title in the following format:

(Product Name) Review - (Review Title)

In order to do this, open up the following file:

app/code/core/Mage/Review/Block/View.php

Add in the following code:

  1. /**
  2.  * Set Page title
  3.  */
  4. protected function _prepareLayout()
  5. {
  6. $headBlock = $this->getLayout()->getBlock('head');
  7. if ($headBlock)
  8. {
  9. $title = array();
  10. if ($product = $this->getProductData())
  11. {
  12. $title[] = $product->getName() . ' Review';
  13. }
  14.  
  15. if ($review = $this->getReviewData())
  16. {
  17. $title[] = $review->getTitle();
  18. }
  19.  
  20. $title = implode(' - ', $title);
  21. $headBlock->setTitle($title);
  22. }
  23.  
  24. return parent::_prepareLayout();
  25. }

If you do not want to modify core files, copy this file to:

app/code/local/Mage/Review/Block/View.php

This has been tested and confirmed to work in Magento 1.3, 1.4.*, 1.5.0.1, 1.5.1.0

The Magento SEO Product Review URLs Extension by Iceberg Commerce has SEO Friendly URLs for all product review pages in addition to the SEO Friendly Page titles for product reviews that are outlined in this blog.



See • MagentoSEOProblems and SolutionsCode Snippits

Comments

By King
09 11 2010 at 08:59 AM

Hi, thanks for posting this tip. It didnt work for me though. Do I need the extension?


By Iceberg Commerce
09 11 2010 at 09:15 AM

Hey King,  You don’t need the extension to use the code posted in the blog post.

What version of magento are you running?


By vignesh
06 01 2011 at 03:23 AM

Very useful. It is working perfectly..

Thanks…....


By vignesh
06 01 2011 at 03:30 AM

i use this code in magento 1.3.1
It’s working fine…......


By HotCustard
25 01 2011 at 01:20 PM

Many thanks, handy tip indeed.


By karminek
25 03 2011 at 01:42 AM

Working good wink


By David
22 07 2011 at 09:43 PM

Does this fix work with Magento Enterprise 1.1?


By Iceberg Commerce
26 07 2011 at 01:38 PM

Hi David,

Yes this change will work with Magento Enterprise.


By Chetaru
02 11 2011 at 04:03 AM

Thanks for sharing this information and resources its really help full for me with the help of this we can improve our magento working.


By allen
11 01 2013 at 08:25 AM

did not work for me in Mage EE


Leave a Comment

Name:

Email: (required but not publicly shown)

URL:

Please enter the word you see in the image below.: