What about using a list comprehension?
https://hexdocs.pm/phoenix/templates.html#examples
scan down to Displaying Lists