Get properly formatted URL from link field within Twig

By mherchel, 18 May, 2022

If your link field has an internal path (eg /path/foo), if you output node.field_link.uri in your twig template, it’ll output internal:/path/foo into your markup. We need to convert this into a proper URL.

Within preprocess, you can get this with



Within twig, you can simply output

            {{ node.field_link.0.url }}