Is there a way to make a link to a community of a foreign instance that opens on the instance of the user that clicks on it?
For example, I would like to make a link to !some_community@foo.com that, when a user of bar.com clicks on it, opens https://bar.com/c/some_community@foo.com instead of https://foo.com/c/some_community.
If it's not possible, don't you think it would be convenient?
31 Comments
fubo@lemmy.world · 6 pts · 3y
Yes, you can do this using a relative URL!
Here's an example.
Here's how I wrote it:
[Here's an example.](/c/asklemmy@lemmy.ml)Because this URL doesn't have a protocol or a domain, your browser fills those in from the URL of the page you're on when you see it. Since that's on your local Lemmy instance, you'll see a link to !asklemmy@lemmy.ml on that instance.
Also: When you're looking at a Lemmy comment, if you don't know how the author wrote the markup for it, you can use the "view source" button underneath the "..." menu.
Note: These links will NOT work between Lemmy and Kbin, because Kbin uses
/m/instead of/c/.el_doso@lemmy.world · 3 pts · 3y
Whoa, that's so cool!
And, man, that's a bummer.
fubo@lemmy.world · 2 pts · 3y
Trickery using URL features, like this, will work from clients that act like a web browser. Other clients may have problems with it. There should probably be a standard syntax for "a link to community X hosted on instance Y" that all clients can learn to support.
sanguinepar@lemmy.world · 1 pts · 3y
Just FYI, this link...
...causes the Jerboa app to crash. I think it's a known issue and hopefully one that gets sorted, but just wanted to warn others.
fubo@lemmy.world · 3 pts · 3y
Wow, good thing to point out.
Relative URLs should work straightforwardly for a UI that runs in a browser, but yeah, I can imagine a custom app doesn't know what domain or even protocol to associate with them.
Catsrules@lemmy.ml · 5 pts · 3y
Edit Sorry I misunderstood. I believe you can link the community as a whole, but posts I don't believe you can.
There isn't a way at the moment. Solutions to this are being discussed on Github
https://github.com/LemmyNet/lemmy-ui/issues/1048
Edit 2
Maybe you can't link a community either, I could have sworn I have seen it done but that could have just happened to be for my instance.
Edit 3
My testing please ignore :)
Test1
boomboxnation@beehaw.org · 4 pts · 3y
That's what this does:
Tap the 'more' skinny hamburger menu just
abovebelow this message to 'view source' of the below:blah blah blah links to asklemmy@lemmy.ml
Actually..better, here is one for an instance that is neither yours or the one you posted into:
blay harg vlar
melonpunk@lemmy.world · 4 pts · 3y
Resolves to
https://lemmy.world/post/asklemmy@lemmy.mlandhttps://lemmy.world/post/canada@lemmy.cawhich are bad links.TomViolence@lemmy.one · 3 pts · 3y
That's perfect! Thank you :)
melonpunk@lemmy.world · 4 pts · 3y
I'd like to know too. I was hoping it would be something simple like
!community@host.comwhich would resolve for everyone. Didn't work when I tried it, though I might not have done it correctly.EDIT: I guess I could try again here !asklemmy@lemmy.ml
EDIT2: Nope: That link goes to
https://lemmy.world/post/!asklemmy@lemmy.mlfor me, which is not valid.dill@lemmy.one · 6 pts · 3y
That link crashes jerboa lol
melonpunk@lemmy.world · 4 pts · 3y
Tested it with Memmy and it states
TypeError: Cannot convert null value to object. Nice.melonpunk@lemmy.world · 3 pts · 3y
Fear my wrath!
Perhyte@lemmy.world · 3 pts · 3y
Once your Lemmy web frontend upgrades to version 0.18, the following should all auto-link with no extra syntax:
These should then all link to the instance you're currently on.
Note: because this is implemented in the frontend and does not change the underlying data, other Fediverse clients will not show these the same unless they also implement this themselves.
TomViolence@lemmy.one · 1 pts · 3y
Nice, thanks for the info!
fennec@feddit.de · 2 pts · 3y
Yes it would be very convenient, right now if I’m recommending a community I simply write out the URL manually to make sure it routes via the respective user’s instance first.
jrubal1462@kbin.social · 1 pts · 3y
I thought it worked if you just linked /c/asklemmy@lemmy.ml
With the only caveat being that users on kbin will need /m/asklemmy.mlWith the only caveat being that users on kbin will need /m/asklemmy@lemmy.ml
I would normally test the crap out of these before posting since I really don't know what I'm doing, but I'm on my phone and mostly busy at the moment. Sorry if it doesn't work.
CoderKat@kbin.social · 1 pts · 3y
Kbin needs /m/asklemmy@lemmy.ml (domain is important) or a bit simpler is with an @ symbol in front: @asklemmy (note: the domain is here but kbin currently renders it without the domain -- that needs to be changed as it has potential to confuse and mislead)
Downside to the /m/asklemmy@lemmy.ml format is that it doesn't currently auto linkify. Gotta do
[/m/asklemmy@lemmy.ml](/m/asklemmy@lemmy.ml)(/m/asklemmy@lemmy.ml)Hopefully kbin soon fixes the !asklemmy@lemmy.ml syntax. It's currently broken. Once fixed, that should work for everyone.
aebrer@kbin.social · 0 pts · 3y
Weirdly enough on kbin.social for me /m/asklemmy.ml link in the post worked for me
jrubal1462@kbin.social · 1 pts · 3y
I'm the problem. As feared I fudged it up as I was rushing to type it up on my phone. As @CoderKat mentioned, the problem with typing it out as /m instead of using @, is that you have to manually enter the visible text in [ ] and the hyperlink in ( ). I got the hyperlink correct and beefed it on the visible text.