I am trying to iterate over a Paragraph field and apply a comma after each Paragraph item.
In the field template that outputs the Paragraph, I am trying:
{%- for item in items %}
{{ item.content }}{{ not loop.last ? ', ' }}
{% endfor -%}
This puts the comma out, but there is a ton of whitespace all over:
I have tried many whitespace control combinations and none seem to have any effect.
How can I remove this sort of behavior entirely? The paragraph field is an entity reference, that renders a view mode, so I don't want to install field delimeter plugin.
edit: Tried the solutions mentioned here:
How remove whitespace on field in twig?
and here:
https://craftcms.stackexchange.com/questions/2789/whitespace-created-when-using-if-statements
as well as in the documentation.
The structure is as follows:
Node -> Paragraph field -> Paragraph (Entity) -> User Reference + Plain text field + rich text
In this context, only the user field is being rendered, and I want to put a comma at the end of each linked name.