Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Remove auto generated div tag around the components

Avatar

Level 1

Hi all,

Need help to get rid of the auto generated extra div wrapper around the components ?  But this should be publisher mode only. Author mode need to be have that because of the editing panel.

Note that im using HTL (Not JSP) and i cannot edit global.js because i need that extra div wrapper on some component as well.

im using AEM 6.2 .

Kindly help on this matter.

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Employee

you can do data-sly-unwrap="${wcmmode.disabled}" then the div is removed is non edit mode.

so

<div ... data-sly-unwrap="${wcmmode.disabled}" ></div>

View solution in original post

7 Replies

Avatar

Administrator

Try this:-

     <sly data-sly-resource="${'foo' @ decorationTagName=(wcmmode.<Mode>? '':'div') , resourceType='my/resource/type}"/>

Feike Visser What do you think here?

~kauutk



Kautuk Sahni

Avatar

Level 7

Have you tried below property

  • cq:noDecoration {boolean} : This property can be added to a component and a true value forces AEM not to generate any wrapper elements over the component.

You can apply this to specific components for which you dont want wraper divs. For more info visit Decoration Tag

Avatar

Correct answer by
Employee

you can do data-sly-unwrap="${wcmmode.disabled}" then the div is removed is non edit mode.

so

<div ... data-sly-unwrap="${wcmmode.disabled}" ></div>

Avatar

Level 5

you can use cq:htmlTag node in your component to generate your custom div with custom class.

cq:tagName : Here you can define the div or section or whatever tag you need.

I observed that if we don't provide cq:tagName the extra div itself is not getting generated (tested in 6.1 SP2)

So may be you can use this way.

Avatar

Level 2

Could you please post an example for this one.

Avatar

Level 3

can anybody provide solution for jsp component

Avatar

Level 1

create cq:htmlTag node as nt:unstructured,

create property cq:tagName and leave it blank.

This seems perfect solution for removing default wrapper from a component.

This node can be used to set any class and to change the wrapper element.