1

I have tried every suggestion I could find and nothing is working. I need to get the actual path or url since I am adding some specific classes to the link. The array is below

enter image description here

I got to this from the following

{% set link = paragraph.field_link.value.0 %}
{{ kint(link) }}

I understand that I need to use the url() or path() function but these require 2 parameters and I am unsure where to get these from.

1 Answer 1

-1

You can try to do like this

{{ content.field_link.0['#url'] }}

That should do it.

This is another possible way of diong it

{{paragraph.field_link.uri }}
1
  • neither one of these options returns the same result as url() or path(), as requested.
    – jenlampton
    Commented Nov 14, 2023 at 2:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.