Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Remove auto generated div tag around the components

gihanperera
Level 1
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
Feike_Visser1
Correct answer by
Employee
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
kautuk_sahni
Community Manager
Community Manager

Try this:-

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

Feike Visser What do you think here?

~kauutk

AnkurAhlawat
Level 7
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

Feike_Visser1
Correct answer by
Employee
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

susheel
Level 5
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.

ajinkayk6258253
Level 3
Level 3

can anybody provide solution for jsp component

rahulp76079001
Level 1
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.