block.rst 359B

12345678910111213141516
  1. ``block``
  2. =========
  3. When a template uses inheritance and if you want to print a block multiple
  4. times, use the ``block`` function:
  5. .. code-block:: jinja
  6. <title>{% block title %}{% endblock %}</title>
  7. <h1>{{ block('title') }}</h1>
  8. {% block body %}{% endblock %}
  9. .. seealso:: :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>`