What is the etymology of 'slug' in a URL?

62,424

Solution 1

The term 'slug' comes from the world of newspaper production.

It's an informal name given to a story during the production process. As the story winds its path from the beat reporter (assuming these even exist any more?) through to editor through to the "printing presses", this is the name it is referenced by, e.g., "Have you fixed those errors in the 'kate-and-william' story?".

Some systems (such as Django) use the slug as part of the URL to locate the story, an example being www.mysite.com/archives/kate-and-william. Even Stack Overflow does this, with the GEB-ish(a) self-referential https://stackoverflow.com/questions/4230846/what-is-the-etymology-of-slug/4230937#4230937, although you can replace the slug with blahblah and it will still find it okay.

It may even date back earlier than that, since screenplays had "slug lines" at the start of each scene, which basically sets the background for that scene (where, when, and so on). It's very similar in that it's a precis or preamble of what follows.

On a Linotype machine, a slug was a single line piece of metal which was created from the individual letter forms. By making a single slug for the whole line, this greatly improved on the old character-by-character compositing.

Although the following is pure conjecture, an early meaning of slug was for a counterfeit coin (which would have to be pressed somehow). I could envisage that usage being transformed to the printing term (since the slug had to be pressed using the original characters) and from there, changing from the 'piece of metal' definition to the 'story summary' definition. From there, it's a short step from proper printing to the online world.


(a) "Godel Escher, Bach", by one Douglas Hofstadter, which I (at least) consider one of the great modern intellectual works. You should also check out his other work, "Metamagical Themas".

Solution 2

Appropriate definitions for slug at dictionary.com I think tell the story:

  1. any heavy piece of crude metal.

  2. Printing

    a. a thick strip of type metal less than type-high.

    b. such a strip containing a type-high number or other character for temporary use.

    c. a line of type in one piece, as produced by a Linotype.

  3. Journalism

    a. Also called catchline. a short phrase or title used to indicate the story content of newspaper or magazine copy.

    b. the line of type carrying this information.

Share:
62,424

Related videos on Youtube

Matthew
Author by

Matthew

Updated on May 07, 2022

Comments

  • Matthew
    Matthew about 2 years

    Is "URL slug" a completely arbitrary word? Or does it stand for something? I used the word in a conversation with someone and when they asked me why it's called that I realized I didn't know.

    I know what it means of course.

    The Stack Overflow tag for [slug] currently defines it as:

    part of a URL that makes it more human readable or SEO-friendly, but without necessarily being required by the web server.

    and WordPress.org defines it as:

    A slug is a few words that describe a post or a page. Slugs are usually a URL friendly version of the post title (which has been automatically generated by WordPress), but a slug can be anything you like. Slugs are meant to be used with permalinks as they help describe what the content at the URL is.

    So - does the word "slug" in a URL have an actual meaning behind it? What is the etymology or meaning of a URL slug?

    • AndrΓ© Caron
      AndrΓ© Caron over 13 years
      Duplicate of stackoverflow.com/questions/427102/in-django-what-is-a-slug? See paxdiablo's answer.
    • Logan Capaldo
      Logan Capaldo over 13 years
      paxdiablo's answer would be good here, but I don't think this question is a duplicate of that one.
    • Ruel
      Ruel over 13 years
      The word 'slug' reminds me of snails and leeches.
    • Parthian Shot
      Parthian Shot about 7 years
      I feel like this would be on-topic on English (language and usage) SE. Ah well. Opportunity missed.
  • caesarsol
    caesarsol about 10 years
    well explained! just a clarification: Django is not an application - it's a framework, and it's just predisposed to use slugs, so it makes a developer choice to use slugs in URLs. this can't be said in real applications, such as Wordpress or Drupal.
  • Walter Tross
    Walter Tross over 8 years
    As for the counterfeit coin, my guess is that it's derived, like all the rest, from meaning #1 in the other answer. See also the dates in etymonline.com/index.php?term=slug
  • Shi B.
    Shi B. about 7 years
    Such beautiful explanation. I really don't understand why a very much legitimate question being flagged as opinion based or out of topic. The attitude of the editors have some serious problem.
  • authentictech
    authentictech almost 7 years
    @ShiB. It was flagged/closed only because it is about word etymology, not programming.
  • binki
    binki over 5 years
    I thought that what StackOverflow did was just for SEO. Normally, I consider a slug to be a unique key myself which is how Wordpress uses it.