Skip to content

Instantly share code, notes, and snippets.

@kevinweber
Last active February 1, 2024 18:09
Show Gist options
  • Save kevinweber/4aa2317286de43b7ba6f0714262c481a to your computer and use it in GitHub Desktop.
Save kevinweber/4aa2317286de43b7ba6f0714262c481a to your computer and use it in GitHub Desktop.
AEM/HTL: Define a list/array within a HTL template (and avoid redundant code!)
<!--/* We can define a list within a Sightly template to avoid redundant code */-->
<sly data-sly-test.versions="${['desktop', 'mobile']}"/>
<sly data-sly-list.identifier="${versions}">
<div class="element ${identifier}">Repeated content</div>
</sly>
<div class="element desktop">Repeated content</div>
<div class="element mobile">Repeated content</div>
@contradictionary
Copy link

thanks for the example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment