I have an array element called "tags" and would like to convert the array of tags to strings separated by a blank space. But how do you do that in Jinja?
I have tried:
{{ tags|join }}
JavaScript Array toString() The toString() method returns a string with array values separated by commas. The toString() method does not change the original array.
The default Jinja delimiters are configured as follows: {% ... %} for Statements. {{ ... }} for Expressions to print to the template output.
Jinja, also commonly referred to as "Jinja2" to specify the newest release version, is a Python template engine used to create HTML, XML or other markup formats that are returned to the user via an HTTP response.
Actually you are almost there, for join with space, just put it like this:
{{ tags|join(' ') }}
see the jinja docs for more details
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With