Text on module project page about Internal Page Cache disabling

Created on 18 January 2024, 8 months ago
Updated 11 March 2024, 7 months ago

Is the text on the module project page still valid when you want to conditionally show some html in twig with the is_mobile function?

About the cache contexts:

By design, the "Internal Page Cache" core module assumes that all pages served to anonymous users will be identical, regardless of the implementation of cache contexts.

If you want to use the mobile_detect cache contexts to vary the content served to anonymous users, "Internal Page Cache" must be disabled, and the performance impact that entails incurred.

{% if is_mobile() %}
<div>mobile</div>
  {% else %}
<div>not mobile</div>
  {% endif %}
💬 Support request
Status

Active

Version

3.0

Component

Documentation

Created by

🇳🇱Netherlands undersound3

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024