etisson
2 years agoAce
only show component if tkb article has a specific label
Hi All,
I'm trying to develop a component that only shows up when a tkb article has a specific tag.
I 'm new to freemarker and liql.
This is what I have so far
<#assign labels = webuisupport.path.parameters.name.get ("label-name","") />
<#if label??>
<#list labels as label>
${label.text}
</#list>
</#if>
<#if env.context.message.id??>
<#assign messageId = env.context.message.id
)>
<#else>
when-missing</#if>
Neither of these seem to retrieve the labels.
Any idea's or solutions?
Thanks
Kind regards,
Erik
etisson
This is an API to get lebels<#assign labels = restadmin("2.0", "/search?q=" + "SELECT text FROM labels WHERE messages.id=${msgid}"?url).data.items![] />
You can iterate through the labels using a loop and implement specific conditions for particular labels.
Here you go
<#assign messageId = page.context.thread.topicMessage.uniqueId>
Make sure you are adding it on message page as it will only work on message page. On rest of the pages, it will throw an error.