Web Content Management (WCM) mode configures information related to how content is requested. In other words, it refers to the mode through which content is to be used.
Available modes are:
- disabled - for end-user requests
- edit - for content editing
- preview - for previews of content editing
To set the WCM mode, add the request parameter
to the URL that points to any resource under the
The default mode is
Checking WCM mode
It is possible to test the current WCM mode and respond depending on the mode value. You can achieve this using both HTL and the Java API.
In Sling Scripting, including HTL, WCM mode flags are available. They can be used to evaluate conditions via, for example, a
In the Java API, the WCM mode is represented by the
pl.ds.websight.pages.foundation.WcmMode enum and delivered
The enum value is set within the request attribute
WcmMode.REQUEST_ATTRIBUTE_NAME and is used to resolve
the WCM mode from the request during request processing. The mode can be tested using the
WcmMode enum methods.
Forcing WCM mode in HTL
If you include resources or scripts in HTL using
data-sly-include, you can set the WCM mode
to a specific value using the
requestAttributes option and the
wcmmode object available in HTL.
Read more about