0 day streak
python / beginner
Snippet

Reusing Templates with Include

The 'include' tag allows you to insert the content of one template into another. This is perfect for reusable components like navigation bars or footers.

snippet.py
python
1
2
3
4
5
{% include 'navbar.html' %}
<div class='content'>
<h1>Welcome!</h1>
</div>
django
Breakdown
1
{% include 'navbar.html' %}
Loads and renders the navbar.html file at this specific location.