Expand my Community achievements bar.

SOLVED

Preventing the auto-created divs in publish mode

Avatar

Level 2

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?

1 Accepted Solution

Avatar

Correct answer by
Level 9

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

View solution in original post

3 Replies

Avatar

Correct answer by
Level 9

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

Avatar

Employee

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

Avatar

Level 7

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