Magento Forum

   
Custom Meta information on every page
 
foley13
Member
 
Total Posts:  39
Joined:  2009-03-09
 

I would like to know how to add different meta information for different pages, for example I have a testimonials module that is using the 2-columns-left template but I would like to have different meta information from what is being pulled from the default page templates. I know you can go into the backend of magento and set up your store meta information but I need my testimonial page to have different meta information.

I’m just wondering if there is something I can add to the xml files to change meta information.

Thankyou for any help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
VnEcoms
Sr. Member
 
Avatar
Total Posts:  121
Joined:  2012-09-13
Vietnam
 

Hi,
You can use one of these ways

xml laylout:

<reference name="head">
<
action="setTitle"><title>This is title of page</title></action>
<
action="setDescription"><description>This is meta description of page</description></action>
</
reference>

php code:
From your controller add following code.

//Add this code after $this->loadLayout();
$this->getLayout()->getBlock('head')->setTitle('This is title of page')->setDescription('This is meta description of page');

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top