beforePublish