Skip to main content

How to get a URL string from a link field within a Twig file

Posted on April 27, 2021

{{ node.field_some_link.0.url }}
  • field_some_link is the machine name of the link field
  • 0 returns the first item of the field item list
  • url gets the url object. Twig will automatically cast this object as a string.