Skip to main content


Remove CQ Decoration Tags

The following Sling filter removes all AEM added html component deocration tags
* Remove aem component wrapper div on publish

scope = {SlingServletFilterScope.INCLUDE},
pattern = "/content/experience-fragments/.*",
extensions = {"html"},
methods = {"GET"}
public class CqDecorationFilter implements Filter {

public void init(FilterConfig filterConfig) throws ServletException {
// do nothing

public final void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException {

final WCMMode mode = WCMMode.fromRequest(request);
final IncludeOptions includeOptions = IncludeOptions.getOptions(request, true);

// Only execute in Publish mode
if (WCMMode.DISABLED.equals(mode)) {
log.debug("Removing component wrapping div.");
// Disable CQ Decoration on cq:includes or sling:includes, only in Publish mode

chain.doFilter(request, response);

public void destroy() {
// do nothing