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.

1108 questions
13
votes
1 answer

How to Set POST permalink/slug in wordpress using wp_insert_post

I m writing simple script using wp_insert_post() to post article in blog. but one problem here, I want to make Title and slug of an URL different. How to achieve this? for example: Title: How to make your diet success Slug:…
Andy
  • 131
  • 1
  • 1
  • 3
13
votes
4 answers

How do you remove invalid characters when creating a friendly url (ie how do you create a slug)?

Say I have this webpage: http://ww.xyz.com/Product.aspx?CategoryId=1 If the name of CategoryId=1 is "Dogs" I would like to convert the URL into something like this: http://ww.xyz.com/Products/Dogs The problem is if the category name contains foreign…
Anthony
  • 6,880
  • 12
  • 57
  • 70
13
votes
9 answers

drupal: standard way for creating a slug from a string

A slug on this context is a string that its safe to use as an identifier, on urls or css. For example, if you have this string: I'd like to eat at McRunchies! Its slug would be: i-d-like-to-eat-at-mcrunchies I want to know whether there's a…
kikito
  • 48,656
  • 29
  • 134
  • 183
13
votes
2 answers

Django Url, Slug for Detail Page

I'm having trouble configuring my url to display a detail view. Clicking on this link: {{ blog.name }} shows blog.html, when I thought it would show blog-detail.html. There are no errors and the browser…
Nick B
  • 8,356
  • 12
  • 55
  • 100
12
votes
5 answers

Does the position of a slug in a URL matter?

FOR SEARCH ENGINE OPTIMIZATION PURPOSES, does the location of the slug within a URL matter? There's no doubt that you could code URL slugs to work properly in any order. I'm more interested to know if search engines place different weights to…
Shawn Miller
  • 7,001
  • 6
  • 43
  • 54
12
votes
3 answers

Slugify and Character Transliteration in C#

I'm trying to translate the following slugify method from PHP to C#: http://snipplr.com/view/22741/slugify-a-string-in-php/ Edit: For the sake of convenience, here the code from above: /** * Modifies a string to remove al non ASCII characters and…
Trav L
  • 13,104
  • 5
  • 28
  • 37
11
votes
2 answers

Django abstract parent model save overriding

I'm trying to write an abstract parent model in Django which will help me making some slug field from name field for many other child models. It uses trans encoding which works perfect for translitterating form cyrillic to latin letters. Then it…
Павел Тявин
  • 2,349
  • 4
  • 21
  • 31
10
votes
2 answers

Validating a slug in Django

I'm guessing this is going to involve regexp or something, but I'll give it a shot. At the minute, a user can break a website by typing something similar to £$(*£$(£@$&£($ in the title field, which is converted into a slug using Django…
user116170
  • 351
  • 1
  • 3
  • 11
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
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
  • 4,588
  • 5
  • 30
  • 48
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:…
Idan Shechter
  • 9,779
  • 25
  • 105
  • 203
9
votes
9 answers

Good name for "URL-friendly title"?

I'm creating a dynamic website with articles. Each article has a title, like "How does one eat a dog and live with it?", but also something I'm now calling "URL Friendly Title", such as "eating-a-dog". I'm looking for a better word for "URL Friendly…
Bart van Heukelom
  • 40,403
  • 57
  • 174
  • 291
9
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
  • 21,796
  • 34
  • 136
  • 218
9
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
  • 24,206
  • 38
  • 107
  • 172
9
votes
3 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…
Upvote
  • 65,847
  • 122
  • 353
  • 577
1 2
3
73 74