Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

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

Avatar

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

<head>

.......

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

........

</head>

 

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>
</sly>
</sly>

 

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