Layout update XML for CMS page

Layout update XML for CMS page

August 17, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Layout update XML for CMS page

Repositioning Magento Blocks Using XML Layout Updates

In Magento, updating the layout of a CMS page involves modifying the XML layout update file associated with that specific page. You’ve already successfully changed the template for the hierarchy menu using setTemplate, which is great! However, your attempt to reposition the block using the after tag hasn’t worked as expected.

Understanding the <after> Tag

The <after> tag in Magento’s layout XML files allows you to specify where a block should be positioned relative to another block. When you use <reference name="block_name" after="target_block">, it tells Magento to place your specified block directly after the target block in the DOM hierarchy.

The Issue with Your Current Approach

Your current configuration is almost correct, but there are a few key points to consider:

  1. Block Scope: In your case, both cms.wrapper and hierarchy_menu are direct children of the content block. When using <after> or <before>, Magento considers the parent scope.

  2. Block Order: The order in which blocks are declared in the XML doesn’t necessarily reflect their final order on the page. It’s important to remember that the actual rendering order can depend on various other factors, including the structure of your theme and any additional layout modifications applied globally or to specific pages.

  3. Unique Block Names: In your example, cms.wrapper is likely a compound block that contains several child blocks. Using it as a target for the after attribute might not position the menu in the exact location you intended within the wrapper.

To better control the positioning of the hierarchy menu relative to the CMS wrapper content:

  1. Identify the Desired Position: Determine exactly where you want the menu to appear within the cms.wrapper block’s structure. This could be before or after a specific sub-block, like the main CMS page content.

  2. Use <move> Instead of <after>: The <move> tag provides more fine-grained control over block positioning. It allows you to specify both the target block and the desired position within that block using as="position".

Here’s how you might modify your XML:

<reference name="content">
    <block type="cms/page" name="hierarchy_menu" as="hierarchy_menu" template="cms/hierarchy/menu-artists.phtml"/>
    <!-- Other CMS page blocks -->
</reference>

Then, to move the hierarchy menu after the main content of the cms.wrapper:

<reference name="content">
    <move element="hierarchy_menu" destination="cms.wrapper" as="menu_after_main_content"/>
</reference>

In this example, menu_after_main_content is a new unique block identifier you’ve created for the hierarchy menu. It’s placed after the main content within the cms.wrapper.

Conclusion

Repositioning Magento blocks requires a strategic approach that considers the structure of your theme and the specific DOM elements involved. Using <move> instead of <after> often provides the necessary control to achieve desired layouts.

Remember, layout updates are applied on a per-page basis in Magento, so you’ll need to create or modify the specific XML update file for the CMS page you’re working with.

If you need further assistance with Magento development or want to explore advanced customization techniques like theme development and extension building, I recommend checking out our comprehensive guides at Laravel Company.

Themes Configuration Orders Import/Export

Our network