Set custom title, keywords and description in Magento module

This article will tell you how to set title, meta tags or add breadcrumb for your custom Magento module page. You can do same way for newly created modules or exiting/core modules. 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.

Looking for improvement for your Magento Store?
Facebook Connector Extension
Product related article extension
Magento Offer popup on exit extension
Unlimited Slideshow Magento Extension
Light Checkout in One Step Magento Extension

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>

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 likeYourModule_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.

This is really helpful for Search Engine Optimization in Magento.

Happy SEOing in Magento

Leave a Reply

Your email address will not be published.

15 + 4 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>