How to print url alias of blog tags in Drupal?
uri.value
is not working
{% for item in node.field_tags %}
{{ item.entity.uri.value }} {{ item.entity.name.value }}
{% endfor %}
{{ item.entity.uri.value }} # this isn't working
CodePudding user response:
You can use path()
function like below to print url alias of the tags:
{% for item in node.field_tags %}
{{ path('entity.taxonomy_term.canonical', { 'taxonomy_term': item.entity.id() }) }}
{% endfor %}
or url()
if you want an absolute url:
{% for item in node.field_tags %}
{{ url('entity.taxonomy_term.canonical', { 'taxonomy_term': item.entity.id() }) }}
{% endfor %}