diff --git a/docs/advanced_topics/jinja2.rst b/docs/advanced_topics/jinja2.rst index fa15d4b4d5..42939bc3ca 100644 --- a/docs/advanced_topics/jinja2.rst +++ b/docs/advanced_topics/jinja2.rst @@ -41,8 +41,8 @@ By default, the Jinja environment does not have any Django functions or filters. In Django templates, ``self`` can be used to refer to the current page, stream block, or field panel. In Jinja, ``self`` is reserved for internal use. When writing Jinja templates, use ``page`` to refer to pages, ``value`` for stream blocks, and ``field_panel`` for field panels. -Template functions & filters -============================ +Template tags, functions & filters +================================== ``pageurl()`` ~~~~~~~~~~~~~ @@ -103,3 +103,24 @@ Output the Wagtail contextual flyout menu for editing pages from the front end {{ wagtailuserbar() }} See :ref:`wagtailuserbar_tag` for more information + +``{% include_block %}`` +~~~~~~~~~~~~~~~~~~~~~~~ + +Output the HTML representation for the stream content as a whole, as well as for each individual block. + +Allows to pass template context (by default) to the stream field template. + +.. code-block:: html+jinja + + {% include_block page.body %} + {% include_block page.body with context %} {# The same as the previous #} + {% include_block page.body without context %} + +See :ref:`StreamField template rendering` for more information + +.. note:: + + The ``{% include_block %}`` tag designed to closely follow the syntax and behaviour + of Jinja's ``{% include %}``, so this tag also + doesn't allow to pass only specified variables into the context as Django's version.