user1480705
user1480705

Reputation: 89

What part of sling framework adds the wrapping div and css classes

What part of sling adds the wrapping div and CSS classes when we do a sling include

When my component does a sling include

<sling:include path="/content/www/mysite/mycontent"/>

Translates to following in the markup

<div class="globalnavigationbar_ globalNavigationBar parbase">
<!-- start component markup -->

<nav class="globalnavbar hidden-xs hidden-sm">

    <div>Component content</div>


</nav>
<!-- end  component markup -->
</div>

I am interested in understanding what code in sling framework adds the wrapping div when doing a sling:include

<div class="globalnavigationbar_ globalNavigationBar parbase">

Tried to lookup[1] and follow the trail without success

[1] https://github.com/apache/sling-org-apache-sling-scripting-jsp-taglib/blob/master/src/main/java/org/apache/sling/scripting/jsp/taglib/IncludeTagHandler.java

The reason for trying to figure this out is trying to replace reference components with Apache SSI using Sling SDI.

Unfortunately, most of our current styles rely on those css classes and when using SDI the wrapping divs are missing.

Redoing our css classes is one option, trying to figure out alternatives if any

Upvotes: 1

Views: 204

Answers (1)

rakhi4110
rakhi4110

Reputation: 9281

I don't think sling adds those tags. It is AEM's WCM which would do it. I do know that there is an IncludeOptions class which lets you override the decoration tag.

There are multiple ways to tell AEM to avoid decorating your components as detailed in this article. That being said, please be cautious with removing your decoration tags in author instance as you might have issues with getting your edit overlays working properly especially if you have components that have floats defined in the CSS.

Upvotes: 4

Related Questions