Added condition before generating the slug