Conditional behavior in template if last array item was found


#1

I’m storing an address as an array in my config file. I’m interating over the array to render put each index on it’s own line by appending the HTML with an
tag. The problem is, that the
after the last index is unnecessary.

To prevent this I only want to add an
of the item is not the last one of the array.

My current template looks like this:

<p>
    {{ range .Site.Params.address }}
        {{ . }}<br>
    {{ end }}
</p>

#2

#3

That works nice, Thanks.