Why do we call a URL segment this?
In web publishing, a “slug” is often used to refer to the text of an individual segment of a URL.
Some systems only use the word to refer to the final segment (“yet-another-slug” in the above example) while others used them to refer to all segments. This is different than a URL – a URL is the combination of slugs.
In publishing, a “slug” is a short name given to a story. It’s a nickname. From a 2014 New York Times article:
Slugs make life easier around the newsroom. Instead of saying, “Would you please shorten that article about President Obama’s immigration announcement by 300 words?” we say things like, “Take 300 out of IMMIG. DIPLO can go a little long. REPUBS is strong.”
This got picked up by content management systems, where they started referring to “slug” as the final segment of a URL that was a key or identifier for the content that was supposed to be delivered by that URL.
From the same NY Times story, here’s the etymology of the word in publishing:
The term slug derives from the days of hot-metal printing, when printers set type by hand in a small form called a stick. Later huge Linotype machines turned molten lead into casts of letters, lines, sentences and paragraphs. A line of lead in both eras was known as a slug.
Why I Looked It Up
I had always wondered. It seems to be accepted in web published, but it’s a odd choice of word, so I figured there had to be a story behind it.