Given the code example, it looks like what you really need is a link. In that case, you can use [get_permalink()][1], which can be used outside of the loop. That should do what you need more reliably than using the post slug. [1]: http://codex.wordpress.org/Function_Reference/get_permalink