I am facing issue with FPC, login and register pages, are adding in Page Cache, I need to disable it.
I have idea that if we add cacheable="false" in any one of block that is used in login/register page then whole page would be excluded from Page Cache.
Is it a good way of disabling cache on specific page or is there any other way around to do this?
1 Answer 1
After some research and comments of Phillipp Sander, I have concluded that cacheable="false" is to good approach to make any page exclude from full page cache.
For login page, I have updated customer_account_login.xml file in my theme and updated this line:
<block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="Magento_Customer::form/login.phtml" cacheable="false">
For signup page, I have updated customer_account_create.xml file in my theme and updated this line:
<block class="Magento\CustomerCustomAttributes\Block\Form" template="Magento_CustomerCustomAttributes::form/userattributes.phtml" name="customer_form_user_attributes" cacheable="false">
This worked for me. Hope it will helpful for others too :)
Explore related questions
See similar questions with these tags.
cacheable="false"will do, already described in my question. My main question is, is it a good way to disable cache on page like this, or is there any other Magento way of disable cache for specific page.