Updated slugify function to replace HTML characters