I lazily added the following to my parent site template:

{% block body %}
    {% block content %}
    {% endblock %}
{% endblock %}

Is this 'allowed' in Twig ?

  • Question title asks if it's a problem, body asks if it's allowed. Accepted answer says "Yes, see here". Will someone either edit the title to reflect permissibility, or the body and answer to reflect, err... problematicability? And yes, I just invented that word. – Sandwich May 1 '19 at 16:53

Yes, see the block tags docs. http://twig.sensiolabs.org/doc/tags/extends.html#block-nesting-and-scope

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.