Get url path of node using entity query
It depends on what you want to generate. To get the \Drupal\Core\Url object for the node:

$node-&gt;toUrl();


To get a URL string:

$node-&gt;toUrl()-&gt;toString();


To get a \Drupal\Core\Link object:

$node-&gt;toLink();


To get an HTML string for the link:

$node-&gt;toLink()-&gt;toString();