Add a twig variable to a certain href url menu item when it is being created I have a Drupal 8 install that I am trying to add a variable to a href  URL when it equals #blog but I can't get it to work. Can anyone see what I am doing wrong? 

This is my menu template file: 

{{item.url}} 
{% if item.url == '#blog'  %} 
    &lt;a href="{{ item.url }}" class="dropdown-toggle" style="color:red;" data-target="#" data-toggle="dropdown"&gt;{{ item.title }} &lt;span class="caret"&gt;&lt;/span&gt; /Tksksks iss&lt;/a&gt;
{% else %}
    {{ link(item.title, item.url) }}
{% endif %}
I just ran into this and have a late answer for you.  Your twig template's if statement does not work because your string comparison is against the Drupal Core URL object. You can, however, create a variable in twig and use that for your comparison. 

{% set menuUri %}{{ item.url }}{% endset %}
{% if menuUri == '#blog'  %} 
    &lt;a href="{{ item.url }}" class="dropdown-toggle" style="color:red;" data-target="#" data-toggle="dropdown"&gt;{{ item.title }} &lt;span class="caret"&gt;&lt;/span&gt; /Tksksks iss&lt;/a&gt;
{% else %}
    {{ link(item.title, item.url) }}
{% endif %}


This will let your comparison to the URL "#blog" work just fine.