I try to build a complete sentence based on tags as follows:
This is a sentence with tag1, tag2 and tag3.
My code is:
{% set topics = entry.topics.first %}
{% for topic in entry.topics.offset(1) %}
{% if topic != entry.topics.last %}
{% set topics = topics ~ ', ' ~ topic %}
{% endif %}
{% endfor %}
<p>This is a sentence with {{ topics }} and {{ entry.topics.last }}.</p>
My problem is that the if clause does not work. The results is always:
This is a sentence with tag1, tag2, tag3 and tag3.