Is using HTL to remove last separator/comma possible? | Community
Skip to main content
Level 3
April 17, 2022
Solved

Is using HTL to remove last separator/comma possible?

  • April 17, 2022
  • 1 reply
  • 751 views

Dear community,

 

I'm using multifield and a sling Model (for loop) to dynamically add content on my footer as below:

 

 

I wonder if it's possible to remove last separator (which is written in my html file) with HTL?

Or this can only be done in the Sling Model?

 

 

Thanks in advance!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by B_Sravan

yes, In brief: check for the last child in the list and don't display it.

<sly data-sly-test="${!itemList.last}"><span class="link-separator"></span></sly>, here I am displaying the separator only if the list item is not the last one. 

1 reply

B_Sravan
Community Advisor
B_SravanCommunity AdvisorAccepted solution
Community Advisor
April 17, 2022

yes, In brief: check for the last child in the list and don't display it.

<sly data-sly-test="${!itemList.last}"><span class="link-separator"></span></sly>, here I am displaying the separator only if the list item is not the last one. 

YuShengAuthor
Level 3
April 18, 2022

Thank you @b_sravan, it works and am getting more ideas about how to use data-sly-test 🙂