---
title: "Template Designer Documentation — Jinja Documentation"
description: "!https://jinja.palletsprojects.com/en/3.1.x/templates/#include"
date: 2023-07-28
published: true
tags:
  - dev
  - jinja
  - python
  - thought
  - webdev
template: link
---


<div class="embed-card embed-card-external">
  <a href="https://jinja.palletsprojects.com/en/3.1.x/templates/#include" class="embed-card-link" target="_blank" rel="noopener noreferrer">
    <div class="embed-card-content">
      <div class="embed-card-title">Template Designer Documentation — Jinja Documentation (3.1.x)</div>
      <div class="embed-card-meta">jinja.palletsprojects.com</div>
    </div>
  </a>
</div>


A feature of jinja that I just discovered is including sub templates. Here is an example from the docs.


``` html
{% include 'header.html' %}
Body goes here.
{% include 'footer.html' %}
```

And inside of my thoughts project I used it to render posts.

``` html
<ul id='posts'>
    {% for post in posts.__root__ %}
    {% include 'post_item.html' %}
    {% endfor %}
</ul>
```

> note that post_item.html automatically inherits the post variable.
