# Help with Hubl loop

**URL:** <https://community.hubspot.com/t/help-with-hubl-loop/24671>\
**Category:** CMS Development\
**Created:** [August 26, 2020, 4:49pm UTC](https://community.hubspot.com/t/help-with-hubl-loop/24671 "2020-08-26T16:49:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmcmillan99](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmcmillan99/32/93181_2.png) [@tmcmillan99](https://community.hubspot.com/u/tmcmillan99)\
**Post date:** [August 26, 2020, 4:49pm UTC](https://community.hubspot.com/t/help-with-hubl-loop/24671/1 "2020-08-26T16:49:26Z")

</div>

I am trying to figure out how to add a separator to the items displayed from the loop except for the last item.

Loop-

{% for t in p.topic\_list %}  
\<a href=“{{ group.absolute\_url }}/topic/{{ t.slug }}” rel=“nofollow”\>{{ t }} \</a\>  
{% endfor %}

Example: item - item - item - item

Thanks,

Terry McMillan

---

<div class="post-metadata">

**Author:** ![stefen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stefen/32/29274_2.png) [@stefen](https://community.hubspot.com/u/stefen)\
**Post date:** [August 26, 2020, 5:23pm UTC](https://community.hubspot.com/t/help-with-hubl-loop/24671/2 "2020-08-26T17:23:48Z")

</div>

@tmcmillan99 you could do this:

```lia-code-sample
{% for t in p.topic_list %}
<a href="{{ group.absolute_url }}/topic/{{ t.slug }}" rel="nofollow">{{ t }}</a>{% unless loop.last %} - {% endunless %}
{% endfor %}

```

---

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [August 26, 2020, 5:30pm UTC](https://community.hubspot.com/t/help-with-hubl-loop/24671/3 "2020-08-26T17:30:14Z")

</div>

Hi @tmcmillan99,

it’s possible with an additional if loop and the [loop.last property](https://developers.hubspot.com/docs/cms/hubl/for-loops#loop-properties).

Change your code as following:

```lia-code-sample
{% for t in p.topic_list %}
<a href="{{ group.absolute_url }}/topic/{{ t.slug }}" rel="nofollow">{{ t }} </a>
<span class="seperator">-</span>
{%if loop.last %}<a href="{{ group.absolute_url }}/topic/{{ t.slug }}" rel="nofollow">{{ t }} </a>{% endif %}
{% endfor %}

```

I’ve added the seperator just to display where it belongs.

best,

Anton

---

<div class="post-metadata">

**Author:** ![tmcmillan99](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmcmillan99/32/93181_2.png) [@tmcmillan99](https://community.hubspot.com/u/tmcmillan99)\
**Post date:** [August 26, 2020, 6:20pm UTC](https://community.hubspot.com/t/help-with-hubl-loop/24671/4 "2020-08-26T18:20:35Z")

</div>

Awesome! Thank you both for the solutions. I’m sure either one will work great.

Terry
