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
16
votes
2 answers

Using slugs in codeigniter

I have heard of people using slugs for generating clean urls. I have no idea how it works. Currently i have a codeigniter site which generates url's like this www.site.com/index.php/blog/view/7 From what i understand by maintaining a slug field it…
esafwan
  • 17,311
  • 33
  • 107
  • 166
15
votes
4 answers

What is the alphanumeric id in a reddit URL?

What is the 7n5lu in the reddit URL http://www.reddit.com/r/reddit.com/comments/7n5lu/man_can_fly_if_you_watch_one_video_in_2 ...and how is it generated? Update: @Gerald, I initially thought this is some obfuscation of the id. It is just doing…
Shameem
  • 14,199
  • 13
  • 40
  • 43
15
votes
4 answers

Use Twig Extension in controller

I have a slugify method in an Twig Extension which i would like to use in some cases in a controller, f.e with redirects. Is there an easy way for this? How could i access functions from Twig Extensions in the controller? Or do i have to make the…
ivoba
  • 5,780
  • 5
  • 48
  • 55
14
votes
5 answers

Check if a string is a possible abbrevation for a name

I'm trying to develop a python algorithm to check if a string could be an abbrevation for another word. For example fck is a match for fc kopenhavn because it matches the first characters of the word. fhk would not match. fco should not match fc…
Björn Lindqvist
  • 19,221
  • 20
  • 87
  • 122
14
votes
10 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
  • 51,734
  • 32
  • 149
  • 189
13
votes
8 answers

Why is just an ID in the URL path a bad idea for SEO?

Why is it a bad idea to have a ID in the URL in terms of SEO? How does this URL http://example.com/user/1234 hurt SEO? Can someone give me a practical example where search engine rankings are worse?
Tower
  • 98,741
  • 129
  • 357
  • 507
13
votes
1 answer

How can I use slugs in Django url

I have tried searching for this question, but mostly I saw regex patterns, so: How can I fill my blog model slug field automatically with the post name without filling it out myself How can I make a link to go to a single post page using the slug…
Cole
  • 564
  • 1
  • 4
  • 14
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
  • 7,210
  • 13
  • 60
  • 70
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
  • 9,267
  • 17
  • 64
  • 105
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,082
  • 6
  • 46
  • 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
  • 14,732
  • 6
  • 30
  • 39
12
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,529
  • 4
  • 25
  • 32
11
votes
2 answers

Rebuilding expo bundle with a different slug

I changed the name of a React Native/Expo app and wanted to change the slug to go with it, but got the error "CombinedError: [GraphQL] Experience with name '@-----/newName' does not exist". Using the old slug, it still works. Is there any way to…
dannnny
  • 117
  • 1
  • 7
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
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
  • 43,244
  • 59
  • 186
  • 301
1 2
3
84 85