Magento: Set title, keywords and description in your module

Suppose, you have created a new module or you have an existing module. You have a frontend page for your module. You want to set or change title, keywords, and/or description of your module page. Well, you can do so by adding few lines of code in layout xml file of your module.

The layout file for you module is present in design/frontend/default/default/layout/YourModuleName.xml. I suppose that you are using default theme and package. The default/default/ in the above path might be different if you are using custom theme and package.

Now, open the layout xml file of your module. You must see the node named default. Write the following code inside the default node.


<reference name="head">
	<action method="setTitle"><title>Your Module Page Title</title></action>
	<action method="setKeywords"><title>your, module, keywords</title></action>
	<action method="setDescription"><title>Your Module Description</title></action>
</reference>

You can set title, keywords, description for specific page of your module as well. Suppose, you have an address page for you module. The address page will have the node named something like YourModule_index_address. You can copy and paste the above xml code inside this node and change the value of title, keywords, and description. Now, the address page of your module will have different title, keywords, and description.

Thanks.