Tag Archives: slugs


When entering a new field, you not only have to learn a new set of skills, but also the industry jargon you might not be familiar with.  Before becoming a software engineer, a ‘slug’ to me was a pest in our garden that my siblings and I would pour salt on and/or run away from.  Now ‘slugs’, and what it means to ‘slugify’ a string, have taken on a whole new meaning.


A slug is a part of a website’s url, usually the part at the end that comes from the title of the page or section.  On this blog, if you were to click on the “About” section, the url would become https://aimeerosato.com/about-2/.  The slug, “about-2”, comes from the fact that it’s about the “About” page.  By convention, slugs are usually lowercase, have spaces in a phrase replaced by a dash or underscore, and have punctuation marks removed.  Sometimes smaller words are dropped or changed to make the slug more readable.  For example, with the article entitled “The U.S. is still using floppy disks to run its nuclear program” from cnn.com, http://www.cnn.com/2016/05/26/us/pentagon-floppy-disks-nuclear/index.html, you can see the slug for that article became “pentagon-floppy-disks-nuclear.”    Interesting article by the way – I remember those huge floppy disks!

Tools to Slugify

When you are writing a program, you might find the need to turn a string into a slug, i.e. to slugify it.  While you can spend the time writing code that cleans up your string, many people have created tools that are ready for you to use.  For instance, there’s an npm package to help with this and also a lodash addon.  A quick search around the internet leads to many other tools like these to help slugify strings.   Happy slugifying!