Thursday, January 19, 2017

How to avoid AEM generated wrapping divs




'cq:htmlTag' can be used to manipulate the wrapper divs that are generated by default by AEM.

This can be added as an nt:unstructured node under the component.

Following properties need to be defined for this node:
1. cq:tagName : The tag that needs to be generated for the component (div, span etc.)
2. class : The CSS class names that would be added to the tag generated as per 1.
3. id : The id of the tag that would be added to the tag generated as per 1.

Either of 2 or 3 or both can be used. However, if neither 'id' nor 'class' is defined, the tag doesn't get generated and AEM behaves in the default manner generating it's own wrapping div.

As an example,


This will generate the component as -
    <div id="component-id" class="grid-tile">
    .
    .
    </div>

How to recompile component JSPs in AEM via Felix Console

In the latest versions of AEM, there is a new feature available, which can be used to recompile the component JSPs.

This helps in resolving issues like:

- Latest changes not available on package install
- ClassNotFound exception on package install

This functionality can be accessed by:

  1. Login to Felix Console and go to Sling >> JSP OR directly go to <aem-domain>/system/console/slingjsp
  2. Click on the Recompile JSPs button



How to recompile clientlibs and invalidate cache?

The clientlibs in AEM consists of JS and CSS and in some instances they get cached; which as would be obvious; causes issues. To remove th...