HTL (sightly) script to populate tags Name

Avatar

Avatar

Satish_Jadhav

Avatar

Satish_Jadhav

Satish_Jadhav

03-06-2020

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

khamat_bn

Avatar

khamat_bn

khamat_bn

04-06-2020

@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 🙂

Answers (2)

Answers (2)

Avatar

Avatar

Ravi_Pampana

MVP

Avatar

Ravi_Pampana

MVP

Ravi_Pampana
MVP

03-06-2020

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

Avatar

BrianKasingli

MVP

Avatar

BrianKasingli

MVP

BrianKasingli
MVP

04-06-2020

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.