What makes a good slug
A slug should be lowercase, plain ASCII, separated by hyphens, and short enough to read in a search result. The limit here starts at 60 characters, because longer addresses often get cut short in search results.
Hyphens beat underscores, because search engines read a hyphen as a gap between words. A readable slug also still makes sense when you paste it into a chat, print it on a card or read it out loud. An opaque ID does not.
The harder part is keeping it the same. A slug is a permanent address. Change it after publication and every link to the page breaks, unless you add a redirect. So while you make it, leave out the parts that will date, such as a year, a version number or a marketing adjective.
- Transliteration
- Accents map to plain ASCII, so é becomes e, ü becomes u, ß becomes ss and ı becomes i. Cyrillic and Greek work too.
- Separator
- Hyphen by default, with underscore and dot available. Repeats collapse to one.
- Duplicates
- In a list, the second slug that would collide gets a number, so no two are alike.
- Trimming
- A length limit cuts at a word boundary rather than mid-word, unless you say otherwise.
Stop words and length
Dropping words like a, the and of makes a slug shorter. It can also make a title hard to read, so how-to-compress-images reads better than how-compress-images. Strip stop words is a switch because the right answer depends on the title.
A length limit cuts at the last whole word, so a slug never ends in half of one. Turn off Trim to whole words and you get a hard cut at the exact length you picked.