Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

How to write SCRIPT tag instead of DIV in HEAD section for following sly block without changing outcome of sly block


Level 2

Hi All,


I am new to Sightly , Could you please help me for below Issue.


I found that a DIV tag in HEAD section but  div tag shouldn't be in head section , it should be in BODY section but as per some requirements the following sly block should be in head section only.

found from view source path



<div style="display:none" id='aiFlag'>true</div>




Above  div tag was found in source path because of following sly block in head.html file in aem


<sly data-sly-test = "${ccmStatus.statusMessage == 'True'}" data-sly-unwrap>
<sly data-sly-use.result="${'com.test.core.widgets.FetchAIFlag' @ path=currentPage.path}" data-sly-unwrap>
<div style="display:none" id='aiFlag'>${result.getAiLogicNeeded}</div>


Now I need to write something for not getting div tag in head section and without changing outcome of above sly block .what i need to write for that, If I use script instead of div in sly block then how to write script  in the above sly block. Please help me if anyone knows the ans


Thanks in advance!

0 Replies