superseriousbusiness / gotosocial

Fast, fun, small ActivityPub server.
https://docs.gotosocial.org
GNU Affero General Public License v3.0
3.82k stars 331 forks source link

[feature] User-selected post aliases / slugs #1739

Open tsmethurst opened 1 year ago

tsmethurst commented 1 year ago

When someone posts on GtS, it generates a url for the post that looks something like the following:

https://example.org/@some_user/statuses/01GZKFFMZ3RRB35YBWEAK5A4H5

This works fine for short, disposable statuses that you blast out quickly, where you don't really care what the URL ends up being.

However, for longer-form blog posts that you'd like to share with others, it would be nice if the link looked something more like:

https://example.org/@some_user/this-is-a-post-about-how-much-i-love-puppies

This gives a lot more information to others when the link is shared, and is also much easier to remember if you're just typing something into your address bar and don't have the link to copy-paste.

It should be possible to achieve this by letting users submit a post alias along with the status when POST-ing to /api/v1/statuses. We could use a field like 'alias' or 'slug' for this. Then, we would simply store that URL instead, and federate that out instead of the generated URL (the AP URI, which is distinct from URL, would not need to change).

In cases where the user already has a post with the alias https://example.org/@some_user/this-is-a-post-about-how-much-i-love-puppies, we could just increment the post alias like this-is-a-post-about-how-much-i-love-puppies-2.

tsmethurst commented 1 year ago

These are called slugs, I forgot the name (thanks Erin)

NyaaaWhatsUpDoc commented 1 year ago

I personally think we should refer to them as snails (in the codebase at least). Very cool idea though!