Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Use Magento Layout XML Files for Adding Custom Information to Magento Modules

July 3, 2017

2 Min Read
Magento layout xml
Reading Time: 2 minutes

Magento is a robust ecommerce platform that is ideal for everyone from lay users to seasoned developers. Magento offers incredible flexibility for adding, editing and setting various information items quickly and without any fuss. This way, solutions to common problems could be deployed without worrying about time constraints and application level issues.

In this article, I will demonstrate how you could easily add Magento custom layout information in module page using the Magento layout XML file. Using this file, you can add custom titles, meta tags, keywords or a description of your Magento module page. You can easily add this custom information to all existing, core or newly created modules.

What is the Magento Module Layout File?

As the name suggests, the layout file is used for rendering the Magento frontend. This Magento custom layout XML file can be found at  app/design/frontend/your_vendor/your_theme/layout/YourModuleName.xml. Each Magento module has its own layout file. For example, the customer module has the customer.xml layout file and the catalog module has the catalog.xml layout file, etc.

By using the layout file, you can set or change the title, meta title, page keywords, and add breadcrumb to a module’s frontend. This can be accomplished by adding a few lines of code in the layout file of the module.

Cloudways Magento Hosting For Developers

Add Magento Custom Layout Info in XML file

Open the layout XML file of a module and search for the element named as <default>. Keep in mind that you will have to write the following code inside the <default> element of the layout file.

<reference name="head">
    <action method="setTitle">
        <title>Your Title</title>
    <action method="setDescription">
        <title>Your Description</title>
    <action method="setKeywords">
        <title>Your Keywords</title>

In addition to the above, you can add other custom information for a particular page of your module. For instance, you have a Location Page for your module. The Location Page will have a layout file named something like YourModule_index_location. You can just copy and paste the above XML code inside the layout file and change the respective information.

You can also add breadcrumbs to a specific page of your module. To add breadcrumbs, let’s take the example of the Location Page. You will have to add code so magento layout update xml works.

Open its layout file and add the following code:

<reference name="breadcrumbs">
    <action method="addCrumb">
    <action method="addCrumb">

The above code is also useful for passing breadcrumb information to the GoogleBot, helps in SEO of your Magento website in general.

The structure of the Magento Layout XML file is easy to understand and is a great way of customizing module pages in Magento. While at first, the structure of the layout file could be tricky to understand, once you begin tinkering with it, you will quickly get the hang of the idea.

Feel free to ask a question about the usage of Layout file. Just post a comment and I will get back you ASAP!


Share your opinion in the comment section. COMMENT NOW

Share This Article

Boost Your Magento Store Performance by 5x Times & Maximize Your Sales

Our fastest Magento hosting can help you in growing your business revenue by 500%

Fayyaz Khattak

Fayyaz is a Magento Community Manager at Cloudways - A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. Fayyaz is a food lover and enjoys driving. You can email him at

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

BFCM 2019