refactor permalink module

@steved555 @pswadi-zendesk