Include tag

{% include "foo.html" %}

The include tag is a simple means for including one template into the current output. Useful for pieces of common functionality and the like.

Examples

To use include is very simple:

foo.html

  <p>Hello World</p>

content.html

  <p>Blah blah blah</p>
  {% include "foo.html" %}
  <p>Yada yada yada</p>

It would output the following:

  <p>Blah blah blah</p>
  <p>Hello World</p>
  <p>Yada yada yada</p>

Passing values

You can also pass values into the included template, like so:

foo.html

  <p>Hello, {{ name }}</p>

content.html

  <p>Blah blah blah</p>
  {% include "foo.html" name = "Dean" %}
  <p>Yada yada yada</p>

It would output the following:

  <p>Blah blah blah</p>
  <p>Hello, Dean</p>
  <p>Yada yada yada</p>