drupal get node id from twig

To get the node ID from Twig in Drupal, you can use the node object available in the Twig template. The node ID can be accessed using the nid property of the node object. Here's an example of how you can retrieve the node ID in Twig:

{{ node.nid.value }}

This code will output the node ID of the current node. Make sure you are using this code within a Twig template file in Drupal.

Please note that the node object may vary depending on the specific Twig template you are working with. If you are not sure which object to use, you can inspect the available variables in the template by using the dump function. For example:

{{ dump(node) }}

This will display all the available properties and values of the node object, including the node ID.

I hope this helps! Let me know if you have any further questions.