Fix permalink bug in uglyurls mode (refs #187).