Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
AEM: Include another resource + modify tag and class name #data-sly-resource
<!--/* More: */-->
<!--/* By default, the AEM decoration tags are disabled, the decorationTagName option allows to bring them back, and the cssClassName to add classes to that element. */-->
<div data-sly-resource="${'headline' @
<!--/* More about the decoration tag: */-->
<!--/* This allows you to include tags from the included resource's _cq_htmlTag.html. */-->
<!--/* If there is more than one resource, wrap each in `sly` tags so the decoration tag gets applied to all of them, not just the first one. */-->
<div data-sly-resource="${'problem' @resourceType='path/to/resource', decoration=true}"></div>
<div data-sly-resource="${'solution' @resourceType='path/to/another/resource', decoration=true}"></div>
<!--/* About Sling selectors: */-->
<article data-sly-resource="${'path/to/resource' @ selectors='selector'}"></article>
<article data-sly-resource="${'path/to/resource' @ selectors=['s1', 's2']}"></article>
<article data-sly-resource="${'path/to/resource' @ addSelectors='selector'}"></article>
<article data-sly-resource="${'path/to/resource' @ removeSelectors='selector1'}"></article>
<!--/* Remove all selectors: */-->
<article data-sly-resource="${'path/to/resource' @ removeSelectors}"></article>
<!--/* Change the WCM mode of an included resource: */-->
<article data-sly-resource="${'path/to/resource' @ wcmmode='disabled'}"></article>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment