Is it possible to perform Includes with flask?

Michael picture Michael · Mar 13, 2012 · Viewed 34.8k times · Source

Say I have a template layout saved in template.html. This template includes a banner, side navigation, content container, and footer. Can I use flask to break up these page elements in such a way that I can have files such as banner.html, sidenavigation.html, etc. and render these different files within template.html?

Answer

Liyan Chang picture Liyan Chang · May 15, 2012

From: http://jinja.pocoo.org/docs/templates/#include

template.html

{% include 'banner.html' %}
{% include 'sidenavigation.html' %}
{% include 'content.html' %}
{% include 'footer.html' %}