{% set ns = namespace(start_letter="0-9") %} {% for song in songs %} {% if not song.artist[0] is in ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] %} {% elif song.artist[0]|upper != ns.start_letter|upper %} {% set ns.start_letter=song.artist[0] %} {% endif %} {% endfor %}
Artist Title
0-9
{{ song.artist[0]|upper }}