Find a URL inside Twig file from content made from another content type (referenced/ has a relationship) I'm new to Drupal, and have stumbled across this issue.
I have entries (entry) that are blogs held inside a blog_listing. E.g.
{% for entry in content.field_blog_listing_entries|field_target_entity %}
    &lt;h2&gt;{{ entry.title.value }}&lt;/h2&gt;
    &lt;p&gt;{{ entry.field_blog_excerpt.value }}&lt;/p&gt;
{% endfor %}

The blogs are their own entries that have automatically generated URLs. e.g. Blog 1 can be found on blogs/blog-1.
How do I get this URL from within the code block above?
I want to access the value in the same manner that I do with the title and field_blog_excerpt to put into an anchor tag. I've tried the same method e.g. entry.url.value &amp; entry.field_blog_url.value but these don't return anything.
How do I access this URL value?
Any help appreciated.
You can use path function with the route for node (entity.node.canonical) and the entry.id (node id) for your blog entry. Pass the id in with the &quot;node&quot; parameter.
&lt;a href=&quot;{{ path('entity.node.canonical', {'node': entry.id}) }}&quot;&gt;&lt;/a&gt;
More info here: https://www.drupal.org/docs/theming-drupal/twig-in-drupal/functions-in-twig-templates