Extract generate_slug to module for posts, comments and categories.