开发者

What is the etymology of 'slug' in a URL? [closed]

开发者 https://www.devze.com 2023-01-26 15:13 出处:网络
Closed. Thi开发者_C百科s question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. Thi开发者_C百科s question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 12 years ago.

This post was edited and submitted for review 9 months ago and failed to reopen the post:

Original close reason(s) were not resolved

Improve this question

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?


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".


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号