I need to add a separator if there are a multiple of types. How can this be done in a for loop?

{% for type in entry.buildType %}{{ type }}{% endfor %}

The outcome is similar to a breadcrumb nav, with an added "/", however the separator should only be placed in between - not for the last.

{% for type in entry.buildType %}
{{ type }}
{% if not loop.last %}/{% endif %}
{% endfor %}

See: https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.