"Twig_Error_Syntax: The block 'content' has already been defined line"
You can remove all twig blocks from the template; that is, remove all of these lines:

{% block content %}
{% endblock %}


This defines a Twig Block, which could be used to extend this template, but this doesn't make sense anymore after you have implemented the condition.