Is there a way to make instance-agnostic links?

https://lemmy.one/post/312098

Is there a way to make instance-agnostic links? - Lemmy.one

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 [email protected] that, when a user of bar.com [http://bar.com] clicks on it, opens https://bar.com/c/[email protected] [https://bar.com/c/[email protected]] instead of https://foo.com/c/some_community [https://foo.com/c/some_community]. If it’s not possible, don’t you think it would be convenient?

That's what this does:

[Some text here](/c/[email protected])

Tap the 'more' skinny hamburger menu just ~~above~~ below this message to 'view source' of the below:

blah blah blah links to [email protected]

Actually..better, here is one for an instance that is neither yours or the one you posted into:

blay harg vlar

On my instance ( feddit.it ) I see two broken links:

both return 404: couldnt_find_post

Should these links work? I'm viewing this thread from Lemmy.ca and both give me a 404 error. When testing with jerboa, the app crashes
That's perfect! Thank you :)
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.

I thought it worked if you just linked /c/[email protected]
With the only caveat being that users on kbin will need /m/asklemmy.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.

Kbin needs /m/[email protected] (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/[email protected] format is that it doesn't currently auto linkify. Gotta do [/m/[email protected]](/m/[email protected]) (/m/[email protected])

Hopefully kbin soon fixes the [email protected] syntax. It's currently broken. Once fixed, that should work for everyone.

Sweet, I didn't know you could shorthand it with just @asklemmy and it would auto-linkify. Thanks.
Weirdly enough on kbin.social for me /m/asklemmy.ml link in the post worked for me
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.

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.

Convert Lemmy and KBin community and user references into local instance links by Zetaphor · Pull Request #1462 · LemmyNet/lemmy-ui

This PR adds a custom plugin to Markdown-It that will add local instance links to any detected community links. It supports the following formats: /c/[email protected] !Community@re...

GitHub
Nice, thanks for the info!