Drupal can automatically create nice-looking URL aliases - for instance

example.com/blog/another-useful-post

rather than

example.com/node/1234

You can get the alias URLs in templates by using the built-in drupal_lookup_path() function:

$url = drupal_lookup_path('alias', 'node/' . $node->nid

This will output the alias url (set in the backend) which is much nicer than a node id.

You can also use aliases with the taxonomy module to get a nice-looking url:

$url = drupal_lookup_path('alias', 'taxonomy/term/' . $tid);</pre>

For taxonomy terms, you'd use the tid rather than the node's nid variable.

Nicked from daipratt.co.uk (and saved here so I can find it again!)