I want to make a specific cms page to be set as a non-cacheable page.

Is there is a way to add XML code in layout update to achieve same

enter image description here

I'm calling block in page HTML with code as below

<p>{{block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html/test.phtml"}}</p>
  • Just add [cacheable="false" ] Apr 14 '20 at 4:28

You can use the below code to achieve it using XML.

<block class="Magento\Framework\View\Element\Template" name="test_view" template="Magento_Theme::html/test.phtml"/>

To make the page non-cacheable you can use cacheable attribute.

<block class="Magento\Framework\View\Element\Template" name="test_view" template="Magento_Theme::html/test.phtml" cacheable="false" />

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.