"Twig_Error_Syntax: The block 'content' has already been defined line" I have a block template in Drupal 8. I want to wrap a section element around the block when it is in the right region.

Twig gives me this error.


  Twig_Error_Syntax: The block 'content' has already been defined line


I understand the error, but I don't know how to fix it. Can anyone show me how to fix the code? 

   {% set block_region_var = block_region %}
   {% if block_region_var == 'footer' %}
     &lt;div{{ attributes.addClass(classes) }}&gt;
       {% block content %}
         {{ content.body }}
       {% endblock %}
     &lt;/div&gt;
   {% else %}
     &lt;section id="{{ section_custom_id }}"&gt;
       &lt;div{{ attributes.addClass(classes,'container') }}&gt;
         {{ title_suffix }}
         {% block content %}
           {{ content.body }}
         {% endblock %}
       &lt;/div&gt;
     &lt;/section&gt;
   {% endif %}
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.