Add a twig variable to a certain href url menu item when it is being created
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.