kingberrill of Magento
4/17/2016 - 5:11 PM

Add Meta Title, Meta Keyword and Meta Description In Custom Module

Add Meta Title, Meta Keyword and Meta Description In Custom Module

<!--Insert this code in custom module layout.xml file.-->
<reference name = "head">
    <action method = "setTitle"><title>Accessory</title></action>
    <action method = "setKeywords"><title>module, keywords</title></action>
    <action method = "setDescription"><title>Module Description</title></action>
</reference>
//app/code/local/namespace/yourmodule/block/yourmodule.php
public function _prepareLayout() {        
    $head = $this->getLayout()->getBlock('head');
    $head->setTitle("Your Title");
    $head->setKeywords("your, keywords, anything");
    $head->setDescription("Your Description");
    return parent::_prepareLayout();
}