!!! note This post is a thought. It's a short note that I make about someone else's content online. Learn more about the process here

Here's my thought on 💭 Template Designer Documentation — Jinja Documentation (3.1.x)


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


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

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


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

note that post_item.html automatically inherits the post variable.


This post was a thought by Waylon Walker see all my thoughts at https://waylonwalker.com/thoughts