this post was submitted on 24 Jun 2023
34 points (100.0% liked)

LemmyTips

891 readers
2 users here now

Welcome to LemmyTips, community where you can share all the tips, tricks and resources related to Lemmy.

founded 1 year ago
MODERATORS
 

cross-posted from: https://lemmy.world/post/530489

The issue: You find a link to a neat lemmy community on some random instance. In order to subscribe, you have go to your instance, search for the community, find it, open it, subscribe...blah!

The fix: Use a simple browser bookmark to go to your home instance and open the federated community in one click.

This works through modifying the URL of the page your on and puts the host name (e.g. lemmy.ml) after an "@" symbol after the community and then changing the host name to your own, hard-coded one.

How to steps:

  1. Create a bookmark in your browser and then "Edit" it.

  2. Change the URL to this text (modify the "lemmy.world" bit with whatever your home instance is):

    For lemmy.world users: javascript:(function(){location.href="https://lemmy.world/c/"+location.href.match(/(?:.*)\/c\/(.*(?=\/)|.*$)/i)[1]+"@"+location.host.toString();})();

    For lemmy.ml users: javascript:(function(){location.href="https://lemmy.ml/c/"+location.href.match(/(?:.*)\/c\/(.*(?=\/)|.*$)/i)[1]+"@"+location.host.toString();})();

  3. Change the name of the bookmark to whatever you want. Mine is named "lemmy.world".

  1. You're all set!

Now, from any federated community main feed page, click on the bookmark and you'll magically be taken to the same community on your local instance. Magic!


Disclaimers: The community must be federated with your instance. You can only do this from a URL that has the community in url (e.g. not from a post or anything).

all 8 comments
sorted by: hot top controversial new old
[–] [email protected] 7 points 1 year ago

Neat work around, thanks for sharing! It would be cool if in the future they come up with a quick link that could work with all instances. So many possibilities of the future.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

Ahem, if you want this done automatically for all URLs on all websites everywhere, you could use this: https://feddit.de/comment/543412 or https://greasyfork.org/en/scripts/469273-lemmy-universal-link-switcher (I made this)

  • If you are already on a page that has a corresponding page on your home instance, a link will automatically be added to the page header.
    redirect
[–] [email protected] 2 points 1 year ago

That's sweet! I'm gonna try it out later.
Feel free to crosspost your post here if you want.