Monthly Archives: June 2012

Magento Set Title,Meta keywords and Meta Description

We can set the Title,Metakeywords and Meta description for our Custom Module.We can use the phtml or Php file for changing the title,Meta keywords and meta descriptionFor Example we have title and Template in our XML file we will change though our php or phtml file

Layout file

<?xml version="1.0"?>
<layout version="0.1.0">
        <reference name="head">
            <action method="setTitle"><title>Custom Module Title</title></action>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        <reference name="right">
            <block type="modulename/blockname" name="mymodule.sidebar" template="templatepath/yourfile.phtml"/>


we can use this code in any php or phtml file


$root = $this->getLayout()->getBlock('root');
$template = "page/2columns-right.phtml";
$head = $this->getLayout()->getBlock('head');

$head->setTitle("Your Title");
$head->setKeywords("Your, Keywords");
$head->setDescription("Your Description");


and refresh your title .keywords and description will be shown in your module page