data-sly-resource not editable without wcmmode='disabled' | Community
Skip to main content
Level 2
March 14, 2025
Solved

data-sly-resource not editable without wcmmode='disabled'

  • March 14, 2025
  • 2 replies
  • 499 views

Is there a way we can make the data-sly resource NOT EDITABLE without making the wcmmode='disabled'?

Heres my sample code:


<sly data-sly-resource="${resourceType='sample/component', wcmmode='disabled'}"></sly>

Best answer by marksarmiento

Was able to do not editable with using READ_ONLY

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/WCMMode.html

2 replies

marksarmientoAuthorAccepted solution
Level 2
March 14, 2025
giuseppebaglio
Level 10
March 14, 2025

You can prevent the component included via data-sly-resource from being editable in AEM authoring mode without disabling wcmmode. Here are two approaches:

Add the decorationTagName attribute to remove the wrapper div that enables authoring UI:

<sly data-sly-resource="${@ resourceType='sample/component', decorationTagName='none'}"></sly>


Add cq:noDecoration property to your component definition (/apps/sample/component/.content.xml):

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Component" cq:noDecoration="{Boolean}true"/>

 

These methods:
1. Keep WCM mode enabled for other components
2. Only remove editability for this specific inclusion
3. Don't affect server-side rendering