About Building Layout Components

In Django templates, you can use the {% include %} template tag with parameters to build layout components, such as navigation links. For example:

1
2
3
4
5
6
{% include "navigation/nav_link.html" with
    link_url=link.url
    link_title=link.title
    is_active=link|is_active:request
    only
%}

Tips and Tricks Programming Templates Django 4.2 Django 3.2 Django 2.2