Preventing the auto-created divs in publish mode | Community
Skip to main content
Level 2
October 16, 2015
Solved

Preventing the auto-created divs in publish mode

  • October 16, 2015
  • 3 replies
  • 1571 views

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.
Best answer by Pawan-Gupta

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

Pawan-Gupta
Pawan-GuptaAccepted solution
Level 8
October 16, 2015

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

Adobe Employee
October 16, 2015

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

Ojjis
Level 7
October 16, 2015

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