I have a custom block that loads multiple nodes from the database and passes it to the twig template. Inside the template I loop the list printing some node details, but I need to create a link on the node title, possibly its clean (alias) URL. The problem is that with node.url I get a security error:
Twig_Sandbox_SecurityError: "Calling "url" method on a "Drupal\node\Entity\Node" object is not allowed
I tried with {{ link(item.label, item.url.value) }}
but I get the same error.
What is the correct way to create a link in twig using the node URL?