Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By noel.delacruz on
Is there a way I can output the link of an entity reference aside from displaying the label. I have an entity reference field that links to a page node content type. I'm trying to figure out how I can output the link.
Here is the sample of the code I've just created. It shows the label of the entity but it does not come with link.
I tried using `entity.uri.value`
or just `entity.uri`
to output the url.
<a href="{{ url('entity.node.canonical', {'node': node.id}) }}"> {{ list.entity.label }} </a>
{% if node.field_academic_experience_ref.entity.label != node.label %}
<div class="program-details">
<h3>Academic Experience</h3>
<ul>
{% for list in node.field_academic_experience_ref %}
<li>{{ list.entity.label }}</li>
{% endfor %}
</ul>
{#
{{ node.field_program_details.value | raw }}
#}
</div>
{% endif %}