Skip to content

Commit 8e5813c

Browse files
Merge pull request #2 from ThomasLandauer/ThomasLandauer-patch-2
Note about nesting blocks and {% endblock NAME %}
2 parents cbc3e26 + 87e2c1e commit 8e5813c

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)