Cleanup permalink generation

Fix permalink generation to not contain various smells. See verbose description in the last commit in this PR.
Also, I would not copy the implementation here but rather use a reasonable candidate here instead.

By referencing the implementation it unnecessarily couples the specs to the implementation. Granted, you always have some coupling between specs and the code under test, I think it should be minimized where possible so that the specs only focus on the most important behaviours.