YSK how to block entire instances from your "all communities" feed and/or the "list of communities" page

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 @linuxFan'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 @linuxFan, 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. CASE SENSITIVE!

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 responsive 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!

Why YSK: some instances have many communities that are centered around topics people are not interested in, and instead of blocking all of those communities one by one, it is easier to just block the whole instance.

Edit: Note that this will remove posts if a blocked instance is listed ANYWHERE in the post body. I accidentally blocked my own post when I tested the lemmynsfw filter just now lol

Edit(s): Further clarification/typos

ADHDefy,
ADHDefy avatar

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

WhiteTiger,

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,

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.
TerabyteRex,

how do i save this post on kbin?

cultsuperstar,

You can boost it and then access it from your profile. It's not a true "save" but it works for now.

grizzly_dw, (edited )
grizzly_dw avatar

FYI, Kbin lets you block entire domains natively, though in a roundabout way.

Looks like you're using kbin.social, so you would put https://kbin.social/d/*domain_you_want_to_block* (e.g. https://kbin.social/d/lemmy.world) in your address bar, which brings up that entire instance (including lemmy instances) as a magazine. Then just block it on the right, the same way you would block a community/magazine.

You can check which domains you've blocked in your settings. Go to Settings > Blocked > Domains.

Maximilious,
Maximilious avatar

Thanks for this - I'm a bit sad that there's a few sites I have subscribed to on feddit.de that post English content, but I keep seeing German posts popping up and I can't read a lick of it! Guess I'll just have to block those communities on a one-by-one basis. :(

TheKingBee,
@TheKingBee@lemmy.world avatar

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.

linuxFan,

If you want you can look through the html and select the exact element you want.

Right click on the channel name/link and select Inspect. This should open up the browser's dev mode and the element should already be highlighted. Right click it and select Copy > CSS Selector. You can paste that into the UBlock filter replacing post-listing.

The first element, div.post-listing:nth-child(17) is only going to check the nth(17th in this case) post on every page, so remove that nth-child() part. The rest of it should select the exact element you're looking for.

The upward(10) means instead of just hiding this element, go 10 levels up in the html document and hide that whole block.

So in my case, it looks like this:

vlemmy.net##div.post-listing > div:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > div:nth-child(1) > ul:nth-child(2) > li:nth-child(1) > span:nth-child(2) > a:nth-child(2) > span:nth-child(2):has-text(@lemmynsfw.com):upward(10)

You'll have to change the domain at the beginning to your instance.

image showing how to select html text for UBlock filter

somedaysoon,

What does going to Settings > Blocks > Block Community do? Doesn't that work?

sp6,

That blocks a single community on an instance, not the whole instance. So take this community, youshouldknow@lemmy.world. 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.

somedaysoon,

Ahhh, okay, thanks.

GroggyKon,
@GroggyKon@lemmy.world avatar

Bless your soul my child. I can now get rid of lemmygrad.

Holyginz,

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

GroggyKon,
@GroggyKon@lemmy.world avatar

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.

Angius,

Tankies

rr7,

Thanks! Should be built in to easily block an entire instance

Wander,
@Wander@yiffit.net avatar

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

Dick_Justice,
@Dick_Justice@lemmy.world avatar

uBlock Origin works on Firefox Beta for Android.

sp6,

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.

Dick_Justice,
@Dick_Justice@lemmy.world avatar

I wonder if something like this could be used to exclude Reddit result from search engine pages.

UprisingVoltage,

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

lemmy,

Pihole is great

lozunn,

Those two are not mutually exclusive, so both could be used at the same time.

lemmy,

I'm not saying that can't be

  • All
  • Subscribed
  • Moderated
  • Favorites
  • youshouldknow@lemmy.world
  • kavyap
  • thenastyranch
  • GTA5RPClips
  • tester
  • InstantRegret
  • DreamBathrooms
  • ngwrru68w68
  • magazineikmin
  • everett
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • cisconetworking
  • megavids
  • khanakhh
  • normalnudes
  • osvaldo12
  • cubers
  • tacticalgear
  • Durango
  • ethstaker
  • modclub
  • anitta
  • provamag3
  • Leos
  • JUstTest
  • lostlight
  • All magazines