can we write multiplication logic in sightly | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by VeenaVikraman

 HTL is purely a templating language and you cannot do any logic manipulation in it. You have to either use Java or JS for the same.

 

If you don't have an associated Java class and this is the only action you want to do with some properties , I will give you a quick tip. In cases like that I always use a Javascript Use-API. For such small things I would prefer JS rather than going a Java route. Refer below link to see how you can write. If you don't get an idea, let me know I will try to provide some sample 

 

https://experienceleague.adobe.com/docs/experience-manager-htl/using/htl/use-api-javascript.html?lang=en 

 

PS:- This is just a personal tip 🙂 

 

 

 

Thanks

Veena ✌

3 replies

Asutosh_Jena_
Community Advisor
Community Advisor
May 27, 2021
MarkusBullaAdobe
Adobe Employee
Adobe Employee
May 27, 2021

Hi @vijithavari!

 

AFAIK calculations are not supported in HTL (formerly known as Sightly) and I don't find it in the specification [1].

In general I would recommend to move any business logic - including any necessary calculations - to an according Sling Model. This allows better exception handling and easier testing.

 

Hope that helps.

 

[1] https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md

VeenaVikraman
Community Advisor
VeenaVikramanCommunity AdvisorAccepted solution
Community Advisor
May 27, 2021

 HTL is purely a templating language and you cannot do any logic manipulation in it. You have to either use Java or JS for the same.

 

If you don't have an associated Java class and this is the only action you want to do with some properties , I will give you a quick tip. In cases like that I always use a Javascript Use-API. For such small things I would prefer JS rather than going a Java route. Refer below link to see how you can write. If you don't get an idea, let me know I will try to provide some sample 

 

https://experienceleague.adobe.com/docs/experience-manager-htl/using/htl/use-api-javascript.html?lang=en 

 

PS:- This is just a personal tip 🙂 

 

 

 

Thanks

Veena ✌