This document extends https://docs.wagtail.io/en/latest/advanced_topics/jinja2.html
While Jinja2 is based on Django templating, there are a few distinct differences. This document describes setup and customization.
1. In the Django settings file:
Jinja templates must be placed in a directory in your app. The template for an model in an app should be created at .
Setting the environment option gives us a place to hook in custom tags and filters.
Django will load this module from the application directory if the Jinja2 template backend is loaded in settings.
This default example is the minimum necessary to use Django-specific tags.
3. Jinja support in Wagtail is explained at the Wagtail site.
4. Application-specific templates go into the jinja/ directory, not the templates/ directory. For example, in an application call “apple” with a page model Pie(Page), the page template is
Support for Wagtailmenus
Using Wagtailmenus with Jinja2 templating requires adding support for the tags main_menu and sub_menu.
In jinja2.py, add: