If you try to access a community on your local instance and it gives you a 404, this automatically takes you to your local instance’s search instead and puts the community in for you.

Recommended to use with https://sh.itjust.works/post/33762](local instance redirect script) by @soy@lemmy.world

I started using Tampermonkey today, so dunno if this works with GreaseMonkey, but I assume it does.

// ==UserScript==
// @name         Lemmings Redirect
// @version      1.0
// @description  Redirect to your local Lemmy instance
// @author       @reddthat.com/u/Fanghole
// @match        https://*/c/*@*
// @icon         https://join-lemmy.org/static/assets/icons/favicon.svg
// ==/UserScript==

var unknownLemmy =
  document.body.textContent === "404: couldnt_find_community";

if (unknownLemmy) {
    // Get URL info
    var splitUrl = location.href.split("/");
    var split2 = splitUrl[4].split("@");
    var instanceUrl = split2[1];
    var community = split2[0];
    var searchUrl =
        "https://" + splitUrl[2] + "/search/q/!" + community + "%40" + instanceUrl + "/type/All/sort/TopAll/listing_type/All/community_id/0/creator_id/0/page/1";

    window.location.replace(searchUrl);
}
No comments yet!

Lemmy Plugins and Userscripts

!plugins@sh.itjust.works

Create post

A general repository for user scripts and plugins used to enhance the Lemmy browsing experience.

Post (or cross-post) your favorite Lemmy enhancements here!

General posting suggestions:

  • Preface the submission with the type of enhancement - ex: [UserScript].
  • Include a screenshot of the enhancement in use (where possible)
  • Indicate the requirements for use (eg, greasemonkey, stylus, etc.)

Thanks!

Community stats

  • 3

    Monthly active users

  • 86

    Posts

  • 540

    Comments