Questions tagged [slug]

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

A slug is a part of a URL that makes it more human readable or SEO-friendly, but without necessarily being required by the web server. Slugs can be generated from a page title and are typically the last part of the url.

Example:

  • Page Title: c# - What's the difference between String and string? - Stack Overflow
  • Slug: whats-the-difference-between-string-and-string

The full URL including the slug is https://stackoverflow.com/questions/7074/whats-the-difference-between-string-and-string. Note that punctuation in the url is typically removed.

1272 questions
10
votes
1 answer

How did the term "slug" (as in URLs) originate?

I've done some Googling trying to find out the origin of the word "slug" as used in URLs. However I can't seem to find any information on it. Does anyone know where this term came from? http://en.wikipedia.org/wiki/Slug_(web_publishing)
Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
10
votes
2 answers

Create URL friendly slug with pure bash?

I am after a pure bash solution to "slugify" a variable and that is not as ugly as mine. slugify: lowercased, shortened to 63 bytes, and with everything except 0-9 and a-z replaced with -. No leading / trailing -. A string suitable to use in URL…
Tom
  • 981
  • 11
  • 24
10
votes
3 answers

Best way to create SEO friendly URI string

The method should allows only "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" chars in URI strings. What is the best way to make nice SEO URI string?
MatBanik
  • 26,356
  • 39
  • 116
  • 178
10
votes
3 answers

Reduce Heroku Compiled Slug Size

I've just updated rails to v2.3.6 on my app under a bamboo-ree-1.8.7 stack and the compiled slug size has grown up to 40.5Mb! Previous to that last git push, the slug size was about 20Mb and was using rails v2.3.5. Is it because my slug has both of…
10
votes
6 answers

Laravel Slugs with Str::slug

Looking at Str::slug for my frontend URL generation but just wondering how you guys go about implementing it with routes etc, for example, how would you guys go about changing http://www.example.com/courses/1 to…
Gareth Daine
  • 4,016
  • 5
  • 40
  • 67
10
votes
1 answer

Enable sluggified URLs in Django

I am trying to enable sluggified URLs in Django of the form that SO uses: example.com/id/slug. I have no problem enabling slugs, and have URLs currently set up of the form: http://127.0.0.1:8000/articles/id/ (eg. /articles/1/) and that works fine.…
Peter Horne
  • 6,472
  • 7
  • 39
  • 50
10
votes
4 answers

MongoDB commenting system Slug, What is it for?

I'm reading a tutorial on MongoDB on how to model the DB for commenting system in here. One comment document has the following information: { _id: ObjectId(...), discussion_id: ObjectId(...), parent_id: ObjectId(...), slug:…
Liron Harel
  • 10,819
  • 26
  • 118
  • 217
9
votes
4 answers

Django: You are trying to add a non-nullable field 'slug' to post without a default; we can't do that

I'm trying to add slug so that the title of a post appears in the url but i get this message on console: You are trying to add a non-nullable field 'slug' to post without a default; we can't do that Please select a fix: 1) Provide a one-off default…
Eric
  • 673
  • 1
  • 7
  • 23
9
votes
3 answers

How to add the slug to all Link generation in an asp.net core website?

I need to be able to control the links being generated by my Url.Content("~") call to be able to accept a Slug in the beginning of the link. Basically the hosting URL will be behind a Load-balancer and may be at the root level or behind a friendlier…
ewassef
  • 286
  • 2
  • 13
9
votes
7 answers

Failed to Generate Signed Apk - An organization slug is required (provide with --org)

After setting up the Sentry.io error tracking I get this error when I try to Generate Signed Apk: Java Compiler error: An organization slug is required (provide with --org) Click on this image and open it to see more details: I cannot understand…
Alireza Noorali
  • 3,129
  • 2
  • 33
  • 80
9
votes
4 answers

Convert any title to url slug and back from url slug to title

I want to convert any title e.g. of a blog entry to a user friendly url. I used rawurlencode() to do that but it gives me a lot of strange strings like %s. The algorithm should consider german chars like Ö, Ä, etc. I want to make a url from title…
DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
9
votes
1 answer

How to make and store slug for post title?

I use MongoDB/mongoose for storing blog posts with the following schema: PostSchema = mongoose.Schema({ title: {type: String}, body: {type: String} }); Now my post urls looks like the following:…
Erik
  • 14,060
  • 49
  • 132
  • 218
9
votes
2 answers

How to convert super- or subscript to normal text in C#

I'm writing a slug generator for making nice urls. I'd like to convert m² to m2, but in a generic way that does this for all superscript (or subscript), not just a simple replace statement. Any ideas?
Jorrit Salverda
  • 715
  • 1
  • 7
  • 17
8
votes
2 answers

Canonical links and 301 Redirect if URL doesn't match slug

I am trying to implement a URL scheme similar to stack overflow's in django/python. E.g. the pk is stored in the URL along with a slug of the title so for this question (id #4787731) the URL…
Ryan
  • 23,871
  • 24
  • 86
  • 132
8
votes
1 answer

wordpress fishpig magento installation - getPostListHtml()

I have a wordpress installation on my magento store utilizing the 3rd party module fishpig. I have a page called list.phtml which posts all the content from a category using $this->getPostListHtml() I added another div and replicated it but now it's…
thismethod
  • 523
  • 1
  • 6
  • 25