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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

HTL (sightly) script to populate tags Name

Satish_Jadhav
Level 1
Level 1

Is there HTL (sightly) tag to populate tag name (page property tag) without using JAVA Models ?

1 Accepted Solution
khamat_bn
Correct answer by
Level 4
Level 4

@Satish_Jadhav 

Yes its possible to use without java. We have to use data-sly-list attribute and should pass the tag property name in expression.After that via item object we can fetch each tags from string array.

Note that tag property should have name cq:tags 

Happy coding,

~BK 🙂

View solution in original post

3 Replies
Ravi_Pampana
Community Advisor
Community Advisor

Hi,

 

You can iterate through tag values using below syntax

 

<ul class="two" data-sly-list="${properties['cq:tags']}">
<li>${item}</li>
</ul>

 

cq:tags in jcr:content

 

Screen Shot 2020-06-03 at 9.33.54 PM.png

Will output as below

Screen Shot 2020-06-03 at 9.33.31 PM.png

Hope this helps!

BrianKasingli
Community Advisor
Community Advisor

It's possible. From not using Sling Models, you can try to use JavaScript-Use or Java-Use API to expose an array of Tag Objects.

khamat_bn
Correct answer by
Level 4
Level 4

@Satish_Jadhav 

Yes its possible to use without java. We have to use data-sly-list attribute and should pass the tag property name in expression.After that via item object we can fetch each tags from string array.

Note that tag property should have name cq:tags 

Happy coding,

~BK 🙂

View solution in original post