Skip to main content
Level 2
Oct 16, 2015 2:27 AM UTC
Solved

Preventing the auto-created divs in publish mode

I inherited some code from another agency that looks like this

if (WCMMode.fromRequest(request) != WCMMode.EDIT && WCMMode.fromRequest(request) != WCMMode.DESIGN && null != componentContext ) { componentContext.setDecorate(false); componentContext.setDecorationTagName(""); componentContext.setDefaultDecorationTagName(""); }

to prevent CQ from auto-generating divs around components. It's in the page's body.jsp, and seems to affect the entire site. I like the results I've seen - are there any gotchas I should be aware of?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Pawan-Gupta
Pawan-GuptaAccepted solution
Level 8
Oct 16, 2015 2:27 AM UTC

Hi,

I think this is the correct way to do it until you are not fine with applying it on complete page. If you think you don't require to certain areas of pages or want to go case by case then you can go more deep and apply this to each component rendering (scriptlet).

Thanks,

Pawan

3 replies

Ojjis
Level 7
Oct 16, 2015 2:27 AM UTC

You could also set this when creating specific components as a property on the component itself. This would then control just the ones you want instead of globally. But I guess that's entirely up to you :)

/Johan 

Translate
Adobe Employee
Oct 16, 2015 2:27 AM UTC

Might not be directly relevant to your original question, but relevant to this topic of the decorated div.   Look at IncludeOptions for controlling decoration of the next component from within code.
http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/wcm/api/components/IncludeOptions.html

See below for some further conversation on this:
http://forums.adobe.com/thread/1229101

Translate
Pawan-Gupta
Pawan-GuptaAccepted solution
Level 8
Oct 16, 2015 2:27 AM UTC

Hi,

I think this is the correct way to do it until you are not fine with applying it on complete page. If you think you don't require to certain areas of pages or want to go case by case then you can go more deep and apply this to each component rendering (scriptlet).

Thanks,

Pawan

Translate