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
6
votes
1 answer

How to create a unique_for_field slug in Django?

Django has a unique_for_date property you can set when adding a SlugField to your model. This causes the slug to be unique only for the Date of the field you specify: class Example(models.Model): title = models.CharField() slug =…
Lance McNearney
  • 9,410
  • 4
  • 49
  • 55
6
votes
1 answer

MVC 4 creating slug type url

i am trying to create a stackoverflow like url. I the following example works fine. But if i remove the controller then it errors out. http://localhost:12719/Thread/Thread/500/slug-url-text Note the first Thread is the controller the second is the…
Raju Kumar
  • 1,255
  • 3
  • 21
  • 39
5
votes
2 answers

exclude files in gems from heroku slugs (using .slugignore, heroku)

A rails 3.0.x project I am working with uses a gem that contains a large amount of test data that isn't needed for the heroku deployment. I would like to exclude this from the heroku slug, as it adds a few dozen megs to the slug (and has pushed us…
corprew
  • 1,991
  • 14
  • 17
5
votes
1 answer

Can I slugignore `node_modules`, `tmp` and `storage` folders?

I want ways to reduce my slug size, and I was wondering if it will be ok to ignore those folders /node_modules, /storage, /tmp, or will that bring me some issues? Also, please let me know any other tip you may have to descrease the slug size.
dani24
  • 2,108
  • 2
  • 26
  • 28
5
votes
2 answers

How do i use slug urls correctly in Django?

Hello, i'm new to Django, and I'm trying to build a web site. at the admin page http://127.0.0.1:8000/admin/posts/post/ i added two posts, eatch one have a slug, the **first slug is first and the second one is second the problem is when i try to…
Abbas Med
  • 69
  • 1
  • 1
  • 5
5
votes
6 answers

TYPO3 9.5.x URL Segment (slug) ignore page

In the past we organized pages inside the page-tree by putting them into pages like "meta" or "submenu". These pages had the option "exclude from speaking url" so their name was not rendered to the url. Is there any option to do this in TYPO3 9.5…
5
votes
4 answers

CakePHP - How to do reverse routing with slug?

I am using CakePHP 1.3. I have a Product model. on the DB table among others there are id and slug fields. If I have a product that is id:37 and slug:My-Product-Title I want the URL for the product to be: products/37/My-Product-Title Instead of…
JD Isaacks
  • 56,088
  • 93
  • 276
  • 422
5
votes
3 answers

Django - Generating random, unique slug field for each model object

I have a Model called ExampleModel in Django, and want each of the model objects to be uniquely identified. Though, I don't want the ID of the object visible to the user in the URL; and so for this reason I want the objects slug to be a unique,…
jayt
  • 758
  • 1
  • 14
  • 32
5
votes
2 answers

How I can generate the slug field the from existing data in database - Doctrine Symfony2

This is my entity, and i used a gedmo annotation, when a new register is created (persits) the slug works correctly but how can i auto-generate slug texts from existing database /** * @Gedmo\Slug(fields={"name"}) * @ORM\Column(type="string",…
Edgar Alfonso
  • 675
  • 2
  • 6
  • 20
5
votes
2 answers

Laravel 5 Unique form validation ignore id / slug

These are my rules in my class: class AppointmentsController extends Controller { protected $rules = [ 'appointment' => ['required', 'min:5'], 'slug' => ['required', 'unique:appointments'], 'description' =>…
Hardist
  • 2,098
  • 11
  • 49
  • 85
5
votes
2 answers

Wordpress category permalink

I have a wordpress based website and the default category permalink is like "website.com/category/category-slug" How can I make it look like "website.com/category-slug"? Of course I will always take care that there is no post/page with the same slug
user3390335
5
votes
1 answer

How to set a slug for a route attribute?

I have an action like this: [HttpGet] [Route("~/books/{id:int:min(1)}/{slug?}")] public ActionResult Book(int? id, string slug) { if (slug == null) { slug = "awesome-book"; return RedirectToAction("Book", new { id, slug }); …
Dan
  • 1,555
  • 2
  • 14
  • 30
5
votes
1 answer

Codeigniter - SEO Friendly URL Structure (Slug Implementation)

I want's to develop a website in codeigniter framework in which i can access any webpage via slug. For example just like WordPress and Magento we can access category page by www.sitename.com/category_type/category_detailpage and also we can access…
Sona
  • 490
  • 2
  • 5
  • 19
5
votes
2 answers

autoslugfield into django-admin interface?

is there any way to integrate an autoslugfield from django-autoslug into the Django-admin interface? I tried putting it inside a list_display as 'slug' but it doesn't show up then in the django-admin interface. Thanks a lot
jhagege
  • 1,486
  • 3
  • 22
  • 36
5
votes
1 answer

URL Slugs: Redirects or 404s?

Some sites, like here at SO, allow 'bogus' slugs in the URL. Before implementing URL slugs on my site, I have a question of 'best practices'... Given a structure like example.com/123/article-slug-here/, if my site allows bogus slugs by querying on…
anonymous coward
  • 12,594
  • 13
  • 55
  • 97