lemmy-ui icon indicating copy to clipboard operation
lemmy-ui copied to clipboard

Community name in post URL

Open joppuyo opened this issue 5 years ago • 34 comments

Right now if you have a post in the Announcements community, the URL will be https://dev.lemmy.ml/post/29441 and in the Linux community, it will be https://dev.lemmy.ml/post/36351 .

Would it make sense to include the community name in the URL, for example, https://dev.lemmy.ml/announcements/post/29441 and https://dev.lemmy.ml/linux/post/29441 so when you see a Lemmy URL you see right away which community it belongs to?

Maybe you could even have the /c/ at the beginning of the post path to further emphasize that the URLs are hierarchical?

joppuyo avatar Jul 01 '20 03:07 joppuyo

It might makes sense for the semantic web, but IMO it really doesn't add that much value... look at how silly this type of thinking has gotten w/ reddit: https://www.reddit.com/r/aww/comments/glenz4/cute_baby_bunnies_think_the_golden_retriever_is/

Its gotten to reddit/community/comments/post_id/weird_lengthened_post_name, when it should be just reddit/post/postid

dessalines avatar Jul 01 '20 03:07 dessalines

On the contrary, I find the Reddit link to be highly readable, even without clicking it, I can see that it's a link to a subreddit called Awww and it's probably a picture of a cute dog. Something like https://reddit.com/post/3ocelxb1w84zvseyz1elglzzq wouldn't tell me anything about the content of the post or where it has been posted.

In my opinion, having the community name in the URL comes down to whether you think of Lemmy as a "one thing" where all the content of one instance is located under it or whether you think each community is "its own thing" so posts should be scoped under it.

But yeah, I think this is just my own musings. I think the current URLs are fine but they could be even more descriptive.

joppuyo avatar Jul 01 '20 03:07 joppuyo

I believe the communities are considered to be "one thing", since they are groups that can span multiple instances.

MasterOfTheTiger avatar Jul 01 '20 05:07 MasterOfTheTiger

If we make this change, we should do it before releasing federation. After that it will get much harder to change the URLs.

Nutomic avatar Jul 01 '20 10:07 Nutomic

I think it's necessary to keep the URLs simple and not change the links to the pages even after the content is changed, which is good for SEO. And if it's an international community, people don't care if the URL contains an introduction, because maybe they use a translation.

ceeim avatar Jul 05 '20 01:07 ceeim

@ceecx I don't think a post URL slug is a necessity, I think community name would be more important. Is it possible that a community is renamed thus invalidating all the URLs pointing to posts in that community?

On second thought I think the IDs are sequential per instance and not community so in theory, if communities are rename-able, the post URL could be routed http://${instance}/c/${community}/${post_id} where the community could be any string.

Like in Stack Overflow where https://stackoverflow.com/questions/62882265/date-parsing-without-considering-timezone-javascript and https://stackoverflow.com/questions/62882265/you-can-have-anything-here-but-it-still-works lead to the same post.

joppuyo avatar Jul 13 '20 18:07 joppuyo

In this case we might be able to do some url redirects, which just completely ignore the community name anyway. IE instance/c/anything/post/1 and instance/post/1 go to the same place.

But that way all the federated urls can still be the same.

dessalines avatar Jul 14 '20 19:07 dessalines

SEO Links very useful for promotion

loid345 avatar Aug 25 '21 12:08 loid345

This suggestion would be very useful. I usually consider myself a power user, but coming from reddit, links to posts and comments are very confusing without the community name and the post title. Where will I end up? What is that link about?

Technically they could be optional (both the community name and the post title, but verified when given that they are correct) similarly to how reddit does it too, but the clients should be encouraged to primarily give this extended URL to the user when copying and such.

And as said above, this could just be a redirect, or even better an alternative URL ("in-backend redirect") so that the readable URL is kept visible on the address bar of the browser.

mpeter50 avatar Jun 09 '23 10:06 mpeter50

just want to add that kbin does this, e.g.:

https://kbin.social/m/[email protected]/t/247807/Emperors-Palace-by-Richard-Wright

now i'm not saying lemmy should emulate kbin in most ways, but i think this leads to much more readable urls

ZeusOfTheCrows avatar Aug 25 '23 19:08 ZeusOfTheCrows

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Please do not use bountysource. Many devs have had trouble getting paid there. You can check out this lemmy community as an alternative https://lemmy.ml/c/bugbounties

For statements from devs who have been unable to cash out from bountysource see: https://github.com/bountysource/core/issues

makeasnek avatar Aug 25 '23 19:08 makeasnek

now i'm not saying lemmy should emulate kbin in most ways, but i think this leads to much more readable urls

Yes, I also think that adopting this wouldn't count as just copying, the real point here is not that others are doing it this way.

The real point is that Reddit and Kbin are doing it because it is significantly more user friendly. You know upfront what (kind of content) to expect at the other side of the link, and that helps with understanding context when you read comments where people link around other posts. Also, to me it seems this way its also easier to load the exact same post and comment chain at the provider where you have registered, because you just need to rewrite the domain at the front.

For statements from devs who have been unable to cash out from bountysource see: https://github.com/bountysource/core/issues

Wow, thats.. interesting. At the same time I'm surprised they are not deleting those issues.

I'm mentioning @dessalines so that they see that their attention is needed. If you are reading this, only the previous comment by makeasnek is relevant regarding the bountysource issue. The first part of my comment is on the topic of this issue.

mpeter50 avatar Aug 25 '23 22:08 mpeter50

I don't have time to work on something like this, but feel free to add it.

dessalines avatar Aug 31 '23 15:08 dessalines

@dessalines I understand and thats ok, but the reason I mentioned you is a different one. It is about bountysource.

Apparently people are not getting their bounties with it for a long time. I'm not sure if its some or all of them.. but from the issues it seems its a long time problem and bountysource does not react on it. Last commit there was 2 years ago, bountysource looks like as if it was abandoned. This may affect the whole project, by new contributors getting disappointed that they cant claim the bounties for their work.

The comment of makeasnek contains some references to more info

mpeter50 avatar Sep 01 '23 21:09 mpeter50

@mpeter50 Okay I've now denied bountysource priveledges on the LemmyNet org. No one used it anyway.

dessalines avatar Sep 04 '23 19:09 dessalines

Want to express support for this. Also there's some good discussion on the topic here: https://lemmy.ca/comment/4525235

jcklpe avatar Nov 03 '23 14:11 jcklpe

Readability issues aside, it's also good for security so people have a general idea of the type of content you can expect if you were to click on a link instead of just slash post slash numbers.

pixiekat avatar Nov 03 '23 14:11 pixiekat

Readability issues aside, it's also good for security so people have a general idea of the type of content you can expect if you were to click on a link instead of just slash post slash numbers.

Steam recently added the name of the game into the URL instead of just the ID number, probably for the same reason.

Die4Ever avatar Nov 03 '23 15:11 Die4Ever

Community name and the slug of post's title should be part of the link.

llagerlof avatar Nov 03 '23 17:11 llagerlof

Note that search results are also missing the community name: https://sh.itjust.works/search?q=banana&type=All&listingType=All&page=1&sort=New

pmarks-net avatar Nov 03 '23 20:11 pmarks-net

I think keeping both formats is the best.

The current url format work like a shortlink. The complete url though is great for all the reasons exposed above.

paulo-roger avatar Dec 28 '23 15:12 paulo-roger

Transferring this to lemmy-ui, as it could be done without changing anything within lemmy.

dessalines avatar Apr 16 '25 15:04 dessalines

Transferring this to lemmy-ui, as it could be done without changing anything within lemmy.

Not true as federation uses the format https://lemmy.ml/p/123 to fetch posts (eg when pasting a post url into the search field). So if this was changed only in lemmy-ui that functionality would break. I believe the corresponding backend issue was closed as too complicated but cant find it now.

Nutomic avatar Sep 26 '25 13:09 Nutomic

Essentially this would just be adding a completely optional dummy community name segment that lemmy-ui ignores, but would make people happy. All the other platforms would have to ignore it also.

Overall tho this doesn't seem that important... its been years and no one's cared about it enough to work on it.

dessalines avatar Sep 26 '25 13:09 dessalines

Can't the community names and post titles be added at the end of the link as a purely visual and optional thing while the leading part of the link would be the actual link like it is now?

Something like: dev.lemmy.ml/post/29441?Linux=How_do_I_switch_to_linux

M4rtineski avatar Sep 28 '25 17:09 M4rtineski

The problem with any changes to the url format is that it will break an important feature of the Fediverse: You can copy any url from your browser and insert it into the search field of another instance to fetch that object via Activitypub. So if the urls dont match thats not going to work anymore.

To be honest the backend change wouldnt be so difficult, it would essentially have to change this line which generates the new post url. But afterwards it needs a lot of testing to find places which rely on the old format and fix them.

Nutomic avatar Sep 29 '25 09:09 Nutomic

I think we'd be fine, if it was an optional URL param that would be completely ignored.

Again, this is totally useless and wouldn't guarantee anything, as anyone could put anything they like in there, but it might make some ppl happy.

dessalines avatar Oct 01 '25 15:10 dessalines

I think we'd be fine, if it was an optional URL param that would be completely ignored.

This is impossible unless you can somehow convince Mastodon, Piefed, Kbin and every single Fediverse project to ignore the parameter. So to implement this means changing the format of ap_id which is generated in the backend.

Nutomic avatar Oct 02 '25 09:10 Nutomic

Wouldn't everything be able to handle it fine, as long as its part of optional URL params, and not part of the path?

IE a post would be:

https://tld.xyz/post/123?community_name_ignore_this=insert_anything_here

dessalines avatar Oct 02 '25 19:10 dessalines

Looks like this works for Lemmy but there is a high chance that other platforms like Mastodon, KBin etc wont support it. Besides this format looks ugly, and probably wont help with SEO as search engines probably ignore unnecessary query params.

Again, if we want to address this we should do it properly and change how post urls are generated in the backend.

Nutomic avatar Oct 07 '25 12:10 Nutomic