Questions tagged [sightly]

Sightly (now known as HTL) - the Apache Sling XSS-aware template language

Sightly is an HTML templating language that was introduced in Adobe Experience Manager 6.0 and later donated to Apache Sling. Its distinguishing features are a tight integration with Sling and helping make your HTML immune to cross-side scripting by supplying sensible defaults and anti-XSS filters.

374 questions
21
votes
2 answers

What is the difference between data-sly-use, data-sly-resource, data-sly-include, and data-sly-template?

What is the difference between: data-sly-use, data-sly-resource, data-sly-include, and data-sly-template? I am reading the doc on Sightly AEM and I am super confused. As far as I can see: data-sly-use is used to add js/java files to render with the…
Hello Universe
  • 3,248
  • 7
  • 50
  • 86
14
votes
1 answer

How to implement Tower of Hanoi in AEM Sightly

I'm trying to implement recursive algorithm solving Tower of Hanoi problem in Sightly. I know this approach may not have many obvious practical applications, I treat it as a puzzle. I end up with something like this:
Tomek Rękawek
  • 9,204
  • 2
  • 27
  • 43
14
votes
2 answers

Conditional Attributes in Sightly Templates (AEM/CQ)

In the Sightly templating language, for Adobe AEM6 (CQ), how do I add an attribute to an element only if a condition is true, without duplicating lots of code/logic? e.g.
Alasdair McLeay
  • 2,572
  • 4
  • 27
  • 50
13
votes
4 answers

AEM 6.0: Additional parameters when using data-sly-resource?

I am trying to implement something which I hope is relatively straight forward... I have one component (lets call it the wrapper component) which contains another component (lets call it the inner component) inside it via the data-sly-resource…
David Woollard
  • 141
  • 1
  • 1
  • 5
11
votes
2 answers

How to concatenate strings in Sightly/HTL?

I have the following code: I want to concatenate properties.linkType to properties.targetURL. Any ideas how it can be done? I've found examples on the…
mrjayviper
  • 2,258
  • 11
  • 46
  • 82
10
votes
3 answers

Default/correct context for HTML href attributes in Sightly

I'm using Sightly and while investigating a bug in my application I noticed a behaviour I didn't expect. Some of the links would render with ampersands in the query string escaped twice. Example:
toniedzwiedz
  • 17,895
  • 9
  • 86
  • 131
8
votes
2 answers

how do I get key/value in sightly from java use class hashmap

I have a basic java use class object that extends WCMUSE and a simple hashmap method - in the sightly code - I have something like ${item} ${item.key} ${item.value} does not work - how do I return key/value pair in sightly code
7
votes
2 answers

Are there requestScope variables in Sightly?

In JSTL you can set variables in on component that are available to all other components after it in the same request. In AEM using sightly is there an equivalent way to pass data between components ? (the use case we are looking at is where we want…
James Lelyveld
  • 294
  • 1
  • 3
  • 11
6
votes
1 answer

Rendering telephone links in HTL based on input from a Rich Text widget

I have a component using the Rich Text Edit widget (xtype="richtext") in my project that's used across the entire site as the default text component. The users would like to be able to insert phone links using the tel URI scheme into the text…
toniedzwiedz
  • 17,895
  • 9
  • 86
  • 131
6
votes
2 answers

Iteration (for loop) in sightly

I had used in jstl. Now i want to use sightly. My usecase is to print numbers from 1 to 10 then how can i iterate in sightly as for loop in java
Manisha Bano
  • 1,853
  • 2
  • 22
  • 34
6
votes
2 answers

JSP content in sightly

A JSP file, like a HTML file can be requested directly in url. However, a JSP file gets compiled during runtime and HTML file doesn't (Although they are both requested the same way). Even a JSP file with no dynamic content gets compiled during…
user5702530
6
votes
3 answers

How do I include a resource in a Sightly template only if it exists?

I would like to use data-sly-resource to include a resource, but only if it exists, e.g.
If the resource does not exist the script execution fails with the following error…
Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
6
votes
5 answers

remove decoration tags aem sightly

How can I remove the decoration tags only in preview/publish mode in AEM sightly? I have seen the question and answer: AEM/CQ: Conditional CSS class on decoration tag This removes the decoration but stops me from editing the components because it…
samwhite024
  • 86
  • 1
  • 1
  • 7
6
votes
1 answer

Sightly: check for empty lists

Using data-sly-list I can iterate over a list object in Sightly, but how can I check if a list is empty? data-sly-list simply renders nothing on empty list objects and I need to display an alternativ text if the list contains no items. Thanks
Markus Haack
  • 103
  • 1
  • 1
  • 7