When I use {{ path('entity.node.canonical', {'node': node.id}) }}
in a node template file, it renders the path alias.
How can I get the canonical path?
{{ path('entity.node.canonical', {'node': node.id}, {'path_processing': false}) }}
{# /**
{% for row in rows %} {% set row_classes = [ default_row_class ? 'views-row', ] %} {% endfor %}
<div{{ row.attributes.addClass(row_classes) }}>
<div> SHOOP</div>
{# The content type is named :"shop" If we have just added one node for in contente type "SHOOP", we can keep the node content type id with : {{ view.result.0.nid) }}. Il we have more node content type, we have to use the loop "for". And in order to reach each field value we use this followig method. Note thate, the active template was : "views-wiew--unuformated.htlm.twig". The suggested view that we create in the theme suggestion we be : "views-view--shop.html.twig"
#}
{% set items = view.result %}
{#for each item 'of content type' #}
{% for item in items %}
{# Champ 'Title' of content type "SHOP" #}
{{ item._entity.title.value|raw}}
{# Champ 'Image 1' du TDC "SHOP" #}
<img src="{{ file_url(item._entity.field_image_1.entity.uri.value) }}"/>
{# Champ 'Image 2' of content type "SHOP" #}
<img src="{{ file_url(item._entity.field_image_2.entity.uri.value) }}"/>
<img src="{{ file_url(item._entity.field_image_3.entity.uri.value) }}"/>
{# field 'Description' of content type "SHOP" #}
{{ item._entity.field_description.value|raw }}
{# Champ 'weight' of content type "SHOP" #}
{{ item._entity.field_weight.value }}
<button type="button" class="btn btn-primary">
<a href="{{ path('entity.node.canonical', {'node' : item.nid }) }}"> {{"See more"|t}}
</a>
</button>
{% endfor %}