Reputation: 11
I need to remove decorator 'div' tags added around components by CQ5 for few select components. They can be part of the mark up in author mode, but it should not be present in the final mark up on publish.
Upvotes: 1
Views: 3242
Reputation: 3402
To change the default div tags to something else , use cq:htmlTag nodes in your components. This lets you modify the tag , classes and id associated with the decorator tag.
[primaryType:nt:unstructured]
under your component.[type:String]
with the tag to be used as value.[type:String]
with class(es) to be added to the enclosing tag **Add id property [type:String]
with id to be added to the enclosing tag
** CQ will add an extra class of its own.
Upvotes: 2
Reputation: 16
You can also use this
<%
if (WCMMode.fromRequest(request) != WCMMode.EDIT &&
WCMMode.fromRequest(request) != WCMMode.DESIGN)
{
IncludeOptions.getOptions(request, true).forceSameContext(Boolean.TRUE);
}
%>
Upvotes: 0
Reputation: 7108
You can wrap them in an if statement. Using JSTL:
<%
if (WCMMode.fromRequest(request) == WCMMode.EDIT) {
%>
<div>
<%
}
%>
Of course you shouln't use java code in the JSP directly, but rather put it in a request variable and use JSTL:
<c:if test="${isEditMode}">
<div>
</c:if>
If you want to get rid of the automatic generated divs, you would need to combine this with the noDecorator property and add the edit dialog script by other means within your optional divs.
Upvotes: 0