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

Allow to relatively link to individual posts

Open db0 opened this issue 2 years ago • 11 comments

Is your proposal related to a problem?

Currently when I want to link to a specific post, I have to always make an absolute link like https://lemmy.dbzer0.com/post/2212

However anyone following this link from a different instance will be prevented from subscribing or commenting.

If I link to it relatively like so /post/2212 it doesn't work, because each instance attaches its own ID to every post.

Adding the domain to the end like so /post/[email protected] also doesn't seem to work

Describe the solution you'd like.

I want a method to allow to link to posts in other instances relatively, to allow discussions to flow natively across the fediverse.

I am thinking of a special format, perhaps like [email protected] which the UI would translate to a hyperlink for the current instance if it's federated and exists, or expand to the normal absolute link https://lemmy.dbzer0.com/post/2212 if it's unknown.

The same functionality should also be possible in the URL links of new posts.

Describe alternatives you've considered.

None that I could think of

Additional context

Cousin of #1227

I am also not sure if this belongs to UI or to lemmy main repo.

db0 avatar Jun 13 '23 09:06 db0

There is a good discussion about this issue here

#1048

Catsrules avatar Jun 14 '23 08:06 Catsrules

Just noticed that lemmy is perfectly capable of finding the local instances version of a comment when the full URL is posted in the search.

As such, I should be fairly easy for a link to a comment on the fediverse be automatically translated to to the local instance by the UI, if it's cached

db0 avatar Jun 16 '23 16:06 db0

We could just have it so that if a URL to a post is posted in the comments, your local instance automatically notices it and interprets it as a link to that post on your own lemmy instance. We'd obviously need to make it so that there's some escaping mechanism, but linking to a post within your own instance seems to be the reasonable default behavior

jacklynnepenick avatar Jun 18 '23 01:06 jacklynnepenick

There is a good discussion about this issue here

#1048

I think that's not the same issue. This is about comments. Which, if they don't even share the same ID could be problematic

Falmarri avatar Jun 20 '23 20:06 Falmarri

I think that's not the same issue. This is about comments. Which, if they don't even share the same ID could be problematic

That was referencing both posts and communities. Although the most recent discussion seems to just focus on communities. So your right it is probably a good idea to seperate the two.

I do think post and comments will be a similar solution as both have unique IDs per instance. Communities should be easier as they are ultimately linking back to a single instance it is just a matter of converting the URL to your instance.

Catsrules avatar Jun 21 '23 20:06 Catsrules

I'm interested in working on this, but we're going to need to hash out syntax. #1462 codeifies the following formats for communities:

Ideally we'd be able to use a similar syntax, but this gets more complicated because of federated content having a local ID, and there being possible ID collisions between a post and comment. For example there could be post #1 with comments #1-3 and then post #2 with comments #4-6.

Unfortunately the /c/ nomenclature is already being used by communities as that would have been useful for comments.

I'm trying to think of what a useful but recognizable shorthand syntax could be for invoking a remote post versus a remote comment

Zetaphor avatar Jun 22 '23 22:06 Zetaphor

Every post/comment needs their own UUID in the URL. When a server displays a link, it checks to see if the UUID exists locally (federated). If so, rewrite the display URL to point to the local federated copy. Otherwise display the original link. Or the local server could do the same rewrite on incoming Federation objects before storing in the DB.

WayneSheppard avatar Jul 02 '23 15:07 WayneSheppard

Is there any news on this topic?

marbovo avatar Jul 06 '23 16:07 marbovo

The best option currently is this violentmonkey script

db0 avatar Jul 06 '23 18:07 db0

The best option currently is this violentmonkey script

For now this will likely remain the best approach as there's no clean and simple way to handle this in without introducing new convoluted syntax that people would have to choose to use for it to be at all effective

Zetaphor avatar Jul 06 '23 20:07 Zetaphor

Considering the ViolentMonkey script is just javascript being injected, couldn't it be implemented into the frontend by default?

henrikx avatar Dec 20 '23 10:12 henrikx