Home » Magento

Magento: Set title, keywords and description in your module

4 February 2010 112 views One Comment

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.

This is really helpful for Search Engine Optimization in Magento.

Happy SEOing in Magento ;)

Popularity: 12%

Related posts:

  1. Magento: Set/Change page layout, title tag, meta keywords and description
  2. Magento: Access denied in admin of custom module
  3. Magento: Read Write XML
  4. Magento: How to get controller, action and module name in template file?
  5. Magento: How to change or reorder top links?
Share/Bookmark
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

One Comment »

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

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

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.