set jinja variable code example
Example 1: how to declare and retrieve variable in jinja template
{% with my_variable="my value" %}
{{my_variable}}
{% endwith %}
{# or #}
{% firstof "my value" as my_variable %}
{{my_variable}}
Example 2: jinja2 set variable
{% if 'clear' in forcast_list[4] %}
{% set img = "sunny.png" %}
{% elif "cloudy" in forcast_list[4] %}
{% set img = "sun-cloudy-thunder.png" %}
{% endif %}