3 ms·
But that's no good because it means the slug may end up having no relation at all to the actual content of the page (after the page has been edited). The only t
by eridius 7y ago
But that's no good because it means the slug may end up having no relation at all to the actual content of the page (after the page has been edited). The only thing worse than no slug is a bad slug. Don't bake bad slugs into your database design.
- cryptonector 7y agoAn integer has even less relation to the actual content.
- xyzzyz 7y agoYes, that's the whole point.
- eridius 7y agoThat's why you pair the immutable integer with a mutable slug. Nobody memorizes slugs so you don't have to worry about supporting the case of a user manually typing in the URL from memory (which is about the only time when having a short integer in the URL would matter). With this scheme, you can change the slug at will, and in fact you can support loading the URL without having a slug at all, or with a made-up slug. This makes the URL resilient to minor transcription errors (e.g. accidentally deleting the last character of the URL, or screwing up when retyping it), and it also means anyone who's aware of this behavior can skip the slug entirely when retyping the URL.