How to check if a link field uses  in template I have a Custom Block type.
It has a link field that allows &lt;nolink&gt;
In the twig template for that Custom Block type I want to check if the link field has &lt;nolink&gt;.


I can see there is a protected value under #url for routeName that is NULL when there is a link, and &lt;nolink&gt; when &lt;nolink&gt; is used, but I can't figure out how to check it.

I can also see there's a protected uri under #url with a similar situation. If &lt;nolink&gt; is used, that value is NULL. If there is a link, the link is in there.
Assuming your link field only allows 1 value.

{% if content.field_link.0['#url'].toString() is empty %} # or use "is not empty" if you're checking if there is a url. 
    # your code goes here
{% endif %}


If your field allows multiple link values then loop:

{% for link in content.field_link %}
  {% if link['#url'].toString() is empty %} # or use "is not empty" if you're checking if there is a url. 
    # your code goes here
  {% endif %}
{% endfor %}