Closed davy-claisse closed 8 months ago
The embed tag is not part of Jinja2 or Django but originally part of Twig, which is a derived form of both.
embed
The goal of this tag is to get the ability to pass parameters to the embedded template by using the with keyword, for instance:
with
We declared the following template in the file person.tera.
Hello {{ name }}!
The embed tag allows us to use it like this (without getting information from Tera Context):
{% embed "person.tera" with { "name" : "World" } %} {% endembed %}
I can give two good documentations of this tag:
Isn't that the same as include with specifying the context in Jinja2? Either way, Tera prefers using macros than includes so that is not going to be added
The
embed
tag is not part of Jinja2 or Django but originally part of Twig, which is a derived form of both.The goal of this tag is to get the ability to pass parameters to the embedded template by using the
with
keyword, for instance:We declared the following template in the file person.tera.
The
embed
tag allows us to use it like this (without getting information from Tera Context):I can give two good documentations of this tag: