Skip to content

Commit 9cd391b

Browse files
ThomasLandauerwouterj
authored andcommitted
Note about nesting blocks and {% endblock NAME %}
| Q | A | ------------- | --- | Doc fix? | [yes] | New docs? | [yes] | Applies to | [2.3] | Fixed tickets | []
1 parent 41f7e6f commit 9cd391b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

book/templating.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,19 @@ When working with template inheritance, here are some tips to keep in mind:
370370
{{ parent() }}
371371
{% endblock %}
372372

373+
* Blocks can be nested. For better overview, you can add the block name to the
374+
``{% endblock %}`` tag like so:
375+
376+
.. code-block:: html+jinja
377+
378+
{% block foo %}
379+
{# ... #}
380+
{% block bar %}
381+
{# ... #}
382+
{% endblock bar %}
383+
{# ... #}
384+
{% endblock foo %}
385+
373386
.. index::
374387
single: Templating; Naming conventions
375388
single: Templating; File locations

0 commit comments

Comments
 (0)