title: remove decoration tags aem sightly
body: <p>How can I remove the decoration tags only in preview/publish mode in AEM sightly?</p>
  
  <p>I have seen the question and answer: <a href="https://stackoverflow.com/questions/26102239/aem-cq-conditional-css-class-on-decoration-tag">AEM/CQ: Conditional CSS class on decoration tag</a></p>
  
  <p>This removes the decoration but stops me from editing the components because it removes the decoration in edit and design mode as well. What is the condition required so that it will only remove the decoration tags in preview/publish? </p>
  
  <p>I have also seen that it is possible to add the following code into the activate method of my java-use class:</p>
  
  <pre><code>if (!getWcmMode().isEdit() &amp;&amp; !getWcmMode().isDesign()) {
             IncludeOptions.getOptions(getRequest(), true).setDecorationTagName("");
      }
  </code></pre>
  
  <p>This removes all but one of the decoration tags see example below:</p>
  
  <p>HTML in wcmmode=disabled without the above code in the activate method:</p>
  
  <pre><code>&lt;ul class="timeline"&gt;
      &lt;div class="section timelineTag"&gt;
      &lt;div class="section timelineTag"&gt;
      &lt;div class="section timelineTag"&gt;
      &lt;li class="clear"&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>HTML in wcmmode=disabled with the above code in the activate method:</p>
  
  <pre><code>&lt;ul class="timeline"&gt;
      &lt;div class="section timelineTag"&gt;
      &lt;li class="event" href="#"&gt;
      &lt;li class="event" href="#"&gt;
      &lt;li class="clear"&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>How can I remove the first decoration DIV tag in the ul as it does not disappear when I add the specified code to the activate method?</p>
  
  <p>As requested here is a detailed look at the component in question (updated 07/05/2015):</p>
  
  <p>Java Class</p>
  
  <pre><code>public class TimelineClass extends WCMUse {
  
      @Override
      public void activate() throws Exception {
          //Remove default wrapping performed by AEM for the preview mode 
          if (!getWcmMode().isEdit() &amp;&amp; !getWcmMode().isDesign()) {
                 IncludeOptions.getOptions(getRequest(), true).setDecorationTagName("");
          }   
      }
  }
  </code></pre>
  
  <p>HTML code:
  - There are two components involved in this. First of all the container component that includes the ul tag 
  - Then the tag component which is dragged and dropped from the sidekick into the container to create, in publish, the lists shown above.</p>
  
  <p>Container code:</p>
  
  <pre><code>&lt;div class="az-timeline row"&gt;
  &lt;section class="small-12 columns"&gt;
      &lt;section class="wrapper"&gt;
          &lt;ul class="timeline"&gt;
              &lt;!-- /* The parsys where all of the timeline tags will be dropped */ --&gt;
              &lt;div data-sly-resource="${'par-wrapper' @ resourceType='foundation/components/parsys'}" data-sly-unwrap&gt;&lt;/div&gt;  
              &lt;li class="clear"&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/section&gt;  
  &lt;/section&gt;
  </code></pre>
  
  <p></p>
  
  <p>Tag component which is dragged and dropped into the container parsys above:</p>
  
  <pre><code>&lt;li data-sly-use.timelineTag="TimelineClass" class="event" href="#"&gt;
      &lt;img style="width: 165px;" data-sly-test="${properties.outerImage}" alt="placeholder" src="${properties.outerImage}"/&gt;
      &lt;article&gt;
          &lt;h5&gt;${properties.heading || 'Timeline heading'}&lt;/h5&gt;
          &lt;h4&gt;${properties.subheading || 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt labore molestias perspiciatis reiciendis.'}&lt;/h4&gt;
          &lt;p&gt;${properties.text || 'Sed molestie, mauris sit amet egestas malesuada, felis magna commodo urna, vel consequat lorem enim ac diam. Aenean eget ex vitae enim cursus facilisis ac feugiat nisl. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.'}&lt;/p&gt;
          &lt;img style="height: 130px;" data-sly-test="${properties.innerImage}" alt="" src="${properties.innerImage}" /&gt;
          &lt;a data-sly-test="${properties.link}" class="az-sbButton" href="${properties.link}"&gt;${properties.linkText || 'More'}&lt;span class="owi-az-linkIcon internal"&gt;&lt;/span&gt;&lt;/a&gt;
      &lt;/article&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Several of the tag components are dragged and dropped into the parsys in the container and the result in wcmmode=disabled is the second ul shown above with the first item in the list surrounded by a div tag</p>