Expand my Community achievements bar.

SOLVED

Removing extra decoration tags in CQ5.6

Avatar

Level 3

Hi , 

    From a earlier post (http://forums.adobe.com/message/5395368) it is mentioned that  global.jsp can be updated with extra code to avoid getting CQ decoration tags in publish instance . However when I tried it with a simple example , decoration tags with substrings 'parsys' or 'parbase'  get removed but still some extra divs gets appended in place.So the case I tested is ,

 My template page component is testpage.jsp  which simply has a cq:include for a parsys apart from inclusion of global.jsp . Then I have a simple dialog component (block.jsp and a clientlib for css)  which I dragged and dropped in to the parsys .Block.jsp has three simple divs enclosed in a div .  

The markups which were generated are as follows . The div's in bold are the extra one's being generated .

Update in Global.jsp - Preview mode

--------------------------

<div class="parsys parsys1">

<div class="block1 section">

<link rel="stylesheet" href="https://forums.adobe.com/apps/training/components/block1/clientlibs.css" type="text/css"><div>

    <div><div>A.</div>      <p>...grabbed hold of a bright, plump lemon and squeezed.</p>   </div>

    <div><div>B.</div>        <p>...waved her hands in the air like she just didn't care.</p>    </div>

    <div><div>C.</div>        <p>...was promptly shot in the face by the tree's owner.</p>    </div>

</div></div></div>

------------------------------------------------

Update in Global.jsp - Publish mode

-------------------

<div class="page testpage">

<div class="page testpage section">

<link rel="stylesheet" href="https://forums.adobe.com/apps/training/components/block1/clientlibs.css" type="text/css">

<link rel="stylesheet" href="https://forums.adobe.com/apps/training/components/block1/clientlibs.css" type="text/css"><div>

    <div><div>A.</div>      <p>...grabbed hold of a bright, plump lemon and squeezed.</p>   </div>

    <div><div>B.</div>        <p>...waved her hands in the air like she just didn't care.</p>    </div>

    <div><div>C.</div>        <p>...was promptly shot in the face by the tree's owner.</p>    </div>

</div></div></div>

------------------------------------

No update in Global.jsp - Publish mode

-----------------

<div class="parsys parsys1">

<div class="block1 section">

<link rel="stylesheet" href="https://forums.adobe.com/apps/training/components/block1/clientlibs.css" type="text/css">

<link rel="stylesheet" href="https://forums.adobe.com/apps/training/components/block1/clientlibs.css" type="text/css"><div>

    <div><div>A.</div>      <p>...grabbed hold of a bright, plump lemon and squeezed.</p>   </div>

    <div><div>B.</div>        <p>...waved her hands in the air like she just didn't care.</p>    </div>

    <div><div>C.</div>        <p>...was promptly shot in the face by the tree's owner.</p>    </div>

</div></div></div>

 

Appreciate any pointers or leads on this .

 

regards

Krishna

1 Accepted Solution

Avatar

Correct answer by
Level 10
4 Replies

Avatar

Correct answer by
Level 10

Avatar

Level 3

@smacdonald2008 ,

   The article was very helpful , and by applying the properties it works . ! Thanks a ton .!

Avatar

Level 3

Hi ,

 The above code preserves the editing functionality but still generates some default CQ decoration div's

 like  

<div class="parsys parsys1">

<div class="block1 sectio

 

To completely remove any decoration tags CQ generates and preserve editing I implemented the following my global_ext.jsp which is my custom jsp and form of extension to global.jsp

if (WCMMode.fromRequest(request) != WCMMode.EDIT && WCMMode.fromRequest(request) != WCMMode.DESIGN) {
               
                 componentContext.setDefaultDecorationTagName("");
        }

 

With CQ 5.6 it works .  I didn't get a a chance to test it on other versions . 

 

Avatar

Level 1

I haven't had time to throughly test this, but if you'd like to preserve the editing functionality in author mode, and disable the extra CQ wrapper divs in publish, you might try creating your own global.jsp (since it's likely included in every one of your jsp files) with the following:

<%@include file="/libs/foundation/global.jsp" %><%
%><%@page import="com.day.cq.wcm.api.components.IncludeOptions"%><%
%><%@page import="com.day.cq.wcm.api.WCMMode"%><%
%><%
          if (WCMMode.fromRequest(request) != WCMMode.EDIT && WCMMode.fromRequest(request) != WCMMode.DESIGN) {
                IncludeOptions.forceSameContext(true);
          }
%>

To implement, you would put this file under a place like /apps/[project name]/components/global.jsp, and in each component you wanted this behavior (or all components ideally, to keep everything standard) you would change <%@include file="/libs/foundation/global.jsp" %> to <%@include file="/apps/[project name]/components/global.jsp" %>.

 

Let me know if this works for you (and I'll finishing implementing as well) :)