Question

I want to know if is possible to create different layouts for each page.
In my Magento_Theme/layout/default.xml I have the copy of the Magento/Theme/view/frontend/layout/default.xml and I want to add this block:

<referenceContainer name="head.components">
    <block class="Magento\Framework\View\Element\Template" name="head.changer" template="Magento_Theme::head-changer.phtml" before="-"/>
</referenceContainer>

But I want this to be applied only in my our-services.phtml page.
Can someone tell me if this is possible, and if it is how can I do it?

Was it helpful?

Solution

If the page you are referring to is a CMS Page this layout adjustment (quoted by you) can be added to "Layout Update" field while editing the CMS Page from Admin panel.

If the page has it's own controller, the block should be added to layout file with module_controller_action.xml name corresponding to action that is rendering the page.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top