Expand my Community achievements bar.

SOLVED

HTL (sightly) script to populate tags Name

Avatar

Level 1

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

1 Accepted Solution

Avatar

Correct answer by
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

Avatar

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!

Avatar

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.

Avatar

Correct answer by
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