Concatenate url() in Twig I tried to do something that I thought was fairly simple, but it's giving an error:

Notice: Array to string conversion in __TwigTemplate_dd3a187031be000574aa6b2149e8b2daacd4f1d086638752b5928811c46b8adf-&gt;doDisplay() (line 132 of vendor/twig/twig/lib/Twig/Environment.php(462) : eval()'d code).

What caused it:
{% set support_url = url('&lt;front&gt;') ~ 'support' %}

So I tried something:
{{ url('&lt;front&gt;') }}&lt;br /&gt;
{% set support_url = url('&lt;front&gt;') %}
{{ support_url }}&lt;br /&gt;
{% set support_url = url('&lt;front&gt;') ~ 'support' %}
{{ support_url }}&lt;br /&gt;

The result of the above is:

http://www.example.com/
http://www.example.com/
Arraysupport

What is going on?
The url function returns a render array, so you can't concatenate it with a string.  You must first convert it to a string.

try render_var():

{% set support_url = render_var(url('&lt;front&gt;')) ~ 'support' %}

&lt;h1&gt;{{ support_url }}&lt;/h1&gt;


This will convert the render array created by the url function to a string.