Getting the pretty url for a node if it's a term I'm using 'pretty urls' with autopath for my nodes so example.com/node-name but I'm having trouble getting that in the context of a term page.

So on the node template itself I'm doing:

 if ( arg(1) == 'term') {
      //do stuff
 }


To get the link to the nodes page:

&lt;a href="&lt;?php echo $base_url . '/node/' . $node-&gt;nid; ?&gt;" class="btn btn-primary" role="button"&gt;View details &amp;raquo;&lt;/a&gt;


But this takes me to the node number url so example.com/node/23 or something like that. I would like the nice url. When I var_dump $node all I can get to build a url is the id, any ideas? Preferably something in the code, I like controlling stuff in the templates if I can.
Figured it out, using drupal_get_path_alias. So something like in the node: 

$url = drupal_get_path_alias('node/' . $node-&gt;nid);