cathoderaydude
@cathoderaydude

I'm sure we all have a lot of unlove for the URLs that CSSposts (among other things) receive; things like "/post/1434178-h3-title-bobby" always feel a little awkward to IM to someone. It's by no means a high priority issue, but it does feel messy, and that weird text (the "slug") sure doesn't help someone predict what they're about to click on!

Bad news: I doubt this can ever be fully "fixed."

Good news: It doesn't need to be!

Background details:

The number in the URL is the actual ID of the post, and the text after it is called a "slug." It's automatically generated from the post contents. This is a very common feature of webapps that allow Posting (including e.g. wordpress) so it's something people have been working on for eons, and unfortunately, slug generation is a miserable, thorny problem.

They're basically a mid-2000s-style solution to hinting at the contents of a link before you click it, and if link previews worked reliably, we wouldn't need them at all. But they don't, so we do, and they're always going to be shitty.

I'm sure staff is using a very simple implementation right now; maybe they have plans to improve it, but any solution will have problems, because slugs are bad! There is no reasonable programmatic solution for, "figure out what part of this blob of code and text is the bit that someone wants in the URL" - it simply has to be done manually, or it will generate garbagey links sometimes.

There's an open request to add slug editing, but from my experience I'd guess that's a pretty expensive ask (adding a database column πŸ™) and frankly - how many people are ever going to use it?

You whip off some shitposts - are you gonna check what the slug looks like? Even if you realize it's bad, do you really want to come up with a new one? That sucks! Ugh! Most posts probably never get linked anywhere; why spend the effort? It's just one more field to get intimidated and discouraged by.

It's maybe worth it on real effortposts, but let's be honest: this is only a problem for the person sending a link, not the person making the post, and thus, the person most interested in fixing the slug would rarely have permission to edit it!

Fortunately: as the person linking a post: you have control over the slug! Because slugs don't matter!

That's right! Cohost doesn't care what comes after the number! For instance, if I copy the link for my bobby hill csspost, it looks like this:

https://cohost.org/cathoderaydude/post/1434178-h3-title-bobby-hil

But try this: https://cohost.org/cathoderaydude/post/1434178-bobby
Or this: https://cohost.org/cathoderaydude/post/1434178-bee-movie
Yep! Those work too!

So: if you're sending someone a link to a post and it doesn't fit your tastes, feel free to edit that bastard! It (the slug) is free real estate!

And: It turns out that "-" is a valid slug. So: https://cohost.org/cathoderaydude/post/1434178-- works! That's a one-button fix! (thanks, @plumpan!)

Also: If you're making a post, and the post has no title, you can force a slug by putting an HTML comment at the beginning of the post body, like this: <!-- ohhh sluggy time -->

I have updated the bug report with a request to make it possible to send no slug at all, which I think would make this even better, since you could just lop off the end of the URL - https://cohost.org/cathoderaydude/post/1434178, done. That'd be a nice stopgap, but I ain't the guy who makes promises about someone else's work, so all I can say is I hope it's as easy a change as I think!


You must log in to comment.

in reply to @cathoderaydude's post:

Oh yes correct, when making/using the URL there's no limit. I'm sure there's a word to describe the difference in how the slugs are being used but I don't know it.

EDIT: Ok if you put enough characters in you will eventually get Error: URI Too Long but there's no reasonable limit.

I think when it auto generates a slug it can be longer? The one on this post is longer than 15 but in my testing I could only get 15.

I should be working right now haha. This is fun though.

I actually played around with a concept like this a couple months ago; encoding identifiers into base64 and generating a slug after it. It would act as a method allowing slugs to change, be shortened etc. but always redirect to the same URL no matter what.
I felt pretty smart coming up with this idea, as very few websites do anything like this. Maybe there's a reason why?

https://gist.github.com/Xevion/7ad79d501f08ffbe34f9e16382f1bd84

And yeah, it's a little unrelated to the true topic, but I feel that it's relevant.