Instead of doing this rendering of each slide in my TWIG like this (see line 6):
{# loop out the slides #} {% for c in contents %} {% set i=i+1 %} {# increas
Within a twig template, you can set the value of a printed variable like this:
{% set rendered %} {{ var_to_print }} {% endset %}