Expand my Community achievements bar.

SOLVED

Unable to build the code- [WARNING] C:\\Users\\VACNIT\\Desktop\\Project Data\\aem-sites\\ui.apps\\src\\main\\content\\jcr_root\\apps\\SFEM\\components\\page\\head.html [25:21]: ${properties.snippetheadstartcurall}: data-sly-test: redundant constant value compari

Avatar

Level 2
Here is my snippet. Unable to build the code due to redundancy warning. build fails. But code works fine in direct deployment
 
<sly data-sly-test=" ${properties.snippetheadstartcurall}">
 <sly> ${properties.snippetheadstartcurall @ context='unsafe'}</sly>
 </sly>
 <sly data-sly-test=" ${!properties.snippetheadstartcurall}">
   <sly>  ${inheritedPageProperties.snippetheadstartcurall @ context='unsafe'}
   </sly>
 
Error info:
[WARNING] C:\Users\VACNIT\Desktop\Project Data\aem-sites\ui.apps\src\main\content\jcr_root\apps\SFEM\components\page\head.html [25:21]: ${properties.snippetheadstartcurall}: data-sly-test: redundant constant value comparison
[WARNING] C:\Users\VACNIT\Desktop\Project Data\aem-sites\ui.apps\src\main\content\jcr_root\apps\SFEM\components\page\head.html [28:22]: ${!properties.snippetheadstartcurall}: data-sly-test: redundant constant value comparison
please assist
1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi @arjunsudhas1995 

 

You can try to modify this by using ternary operator like,

<sly>${properties.snippetheadstartcurall ? properties.snippetheadstartcurall : inheritedPageProperties.snippetheadstartcurall @ context='unsafe'}</sly>

Hope it'd help!

View solution in original post

3 Replies

Avatar

Correct answer by
Level 4

Hi @arjunsudhas1995 

 

You can try to modify this by using ternary operator like,

<sly>${properties.snippetheadstartcurall ? properties.snippetheadstartcurall : inheritedPageProperties.snippetheadstartcurall @ context='unsafe'}</sly>

Hope it'd help!

Avatar

Community Advisor
<sly data-sly-test.snippet=" ${properties.snippetheadstartcurall}" />
<sly data-sly-test="${snippet}"> ${snippet @ context='unsafe'}</sly>
<sly data-sly-test="${!snippet}">${inheritedPageProperties.snippetheadstartcurall @ context='unsafe'}</sly>

You can define a variable and reuse with data-sly-tes as well. 

 

You can use the solution suggested by @mayank0928 



Arun Patidar