extract publish menu itself into function