Refactor slug generation

This is a partial fix for bugs which prevent published documents from being visible through the frontend.

The next part is in
https://github.com/alphagov/govuk_content_api/pull/163