Disclaimer: I am just a random stranger on the internet who likes uBlock Origin, read a handy comment, and figured out how to press F12. I am by no means a webpage expert, and these changes may have unintended consequences

I wanted to bring more attention to @[email protected]’s comment on how to block entire instances (not just specific communities on those instances) from your “all communities” feed, as well as add my own method to block them from the “list of communities” page.

This only works if you are using a web browser that supports uBlock Origin (so unfortunately, will not work on any of the mobile apps).

Firstly, install uBlock Origin if you haven’t already. Then, click on the uBlock extension icon -> “Gears” (settings) icon -> My Filters. Per @[email protected], add:

your.lemmy.instance.com##.post-listing:has-text(@theInstanceYouWantToBlock.com)

Then click “Apply Changes”

So if I were not interested in any of lemmynsfw.com’s content, I would add:

lemmy.world##.post-listing:has-text(@lemmynsfw.com)

@linuxFan’s ELI5 explanation:

lemmy.world## - only use this filter on this site

.post-listing - evaluate everything on the page with the class name post-listing

has-text(@lemmynsfw.com) - the text we want to filter

Similarly, if you want to filter entire instances out of the “list of communities” page, you would add:

your.lemmy.instance.com##tr:has-text(@theInstanceYouWantToBlock)

I believe the tr is table-responsive, which is the type of table displayed on the “list of communities” page. If there are other reactive tables on a different Lemmy page that I don’t know about, it may affect those. Also, if Lemmy’s website is updated, these filters may no longer work.

If someone knows of a better method of doing this, please chime in. But otherwise, enjoy!

  • UprisingVoltage@feddit.it
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    Very useful, thank you for sharing!

    Also if someone isn’t using ublock origin yet, please do! It’s essential to browse the internet these days

  • ADHDefy@kbin.social
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    You can also try out kbin as a Lemmy alternative, as it’s fully federated with Lemmy and lets you block domains.

    • Holyginz@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      1 year ago

      What’s wrong with lemmygrad? Serious question since I’m out of the loop.

      • GroggyKon@lemmy.world
        link
        fedilink
        English
        arrow-up
        3
        arrow-down
        2
        ·
        1 year ago

        It’s essentially a community that promotes left wing extremist ideologies and is very much in favour of authoritarians who don’t like democracy. Lots of hate for the west, lots of whataboutisms and lots of love for Putin and Xi and lots of excuses for the invasion of Ukraine and the Uyghur genocide. I’m left leaning but they have more in common with fascists than anything else.

    • sp6@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      1 year ago

      I think it works on non-beta Android Firefox too. I just meant stuff like Jerboa, Mlem, etc; mobile apps you download from an app store.

  • Wander@yiffit.net
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Great post! If it works with unblock origin then it also works with Firefox on Android.

  • TheKingBee@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    1 year ago

    Exactly what I was looking for and the example is exactly what I wanted to do.

    Small problem, this blocks every mention of lemmynsfw, even this post.

    • sp6@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 year ago

      That blocks a single community on an instance, not the whole instance. So take this community, [email protected]. You can block youshouldknow (the community), but you cannot block all of lemmy.world (the instance). The method in my post allows you to block entire instances.

  • WhiteTiger@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    1 year ago

    What if i just want to block any post from any community from any instance with the word ‘trump’ in the title, is there a way to do that?

    • sp6@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Sort of. Change has-text(@TheInstanceYouWantToBlock) to has-text(ThePhraseYouWantToBlock).

      Just note that:

      1. The filter is case-sensitive, and
      2. This will block the post if the phrase is anywhere in the post. So even if the phrase isn’t in the title, but is in the post’s text body, the OP’s username, the community name, etc, it will still be blocked. So blocking “trump” could accidentally block a playingcards post that has “trump card” somewhere in the post body.