How to tell if a menu link is route: or not? Trying to theme a menu in Drupal 8, running into a case where we need to add classes on certain links.

In the case of a menu link that is route:&lt;nolink&gt; we need to not add any class at all. 

Example:

{% if item.below and item.url %}
 {{ link(item.title, item.url, { 'class':['link', 'link--arrow']} ) }}
{% else %}
 // not a link
{% endif %}


How can we tell at this level that item.url is route:&lt;nolink&gt;? 

Update:

Current solution so far, is there a better way?

{% if not item.url.isExternal() and item.url.getRouteName() is same as('&lt;nolink&gt;') %}
  {{ link(item.title, item.url) }}
{% else %}
  {{ link(item.title, item.url, { 'class':['link', 'link--arrow']} ) }}
{% endif %}
Might be able to do a toString and if it's not actually a link that will come back empty

{% if item.below and item.url and item.url.toString|length &gt; 0 %}