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
That is because $this->render() returns a Response object. Instead of $this->render(), use $this->renderView().
$this->render()
Response
$this->renderView()