When rendering the following template, I get the error A block definition cannot be nested under non-capturing nodes:
{% extends "layout.twig" %}
{% if false %}
{% block content %}FOO{% endblock %}
{% endif %}
(note that there is no need for the layout.twig template to exist for the error to be thrown)
But when rendering the following one, I don't get any error:
{% if false %}
{% block content %}FOO{% endblock %}
{% endif %}
In both cases, there is a block definition nested under a non-capturing node (if), so why is the first template failing and why is the second one not failing?
When rendering the following template, I get the error
A block definition cannot be nested under non-capturing nodes:{% extends "layout.twig" %} {% if false %} {% block content %}FOO{% endblock %} {% endif %}(note that there is no need for the
layout.twigtemplate to exist for the error to be thrown)But when rendering the following one, I don't get any error:
{% if false %} {% block content %}FOO{% endblock %} {% endif %}In both cases, there is a block definition nested under a non-capturing node (
if), so why is the first template failing and why is the second one not failing?