Cleanup permalink generation

Fix permalink generation to not contain various smells. See verbose description in the last commit in this PR.
I don't believe the candidate numbers have letters in them.