Reposting from https://lemmy.world/post/24545370

Some other people had suggestions for other apps (such as Voyager) having built-in keyword filters, feel free to have a look at the original post

Why YSK: Certain topics are stressful and tend to spread all over the site, including to unrelated communities. Blocking communities can be overkill and ineffective, and likewise for blocking individual users.

To do so, open up the uBlock Origin dashboard, go to the ‘My filters’ tab, and add this filter:

lemmy.world##article.row:has-text(/word1|word2|word3|word4/i)

For example:

lemmy.world##article.row:has-text(/Trump|Elon|Musk|nazi/i)

Then apply the changes and reload any open tabs, and all posts which contain any of your filtered words will simply not show up.

You’ll have to change “lemmy.world” at the start to whatever your actual instance is. You can filter as many or as few words as you want, just keep the / at the start, the /i at the end, and separate words with | pipes. What’s actually being filtered is a case-insensitive regex, if you want to get fancy with it.

Here are equivalent filters for reddit and Ars Technica:

reddit.com##div.thing[data-context="listing"]:has-text(/word1|word2|word3|word4/i)
arstechnica.com##:not(:not(head>title:has-text(/^Ars Technica/))) article:has-text(/word1|word2|word3|word4/i)

As a disclaimer, I made these myself, and I’m not particularly familiar with creating uBlock Origin filters. There may be better ways to do this. Also the reddit one is specific to old.reddit.com, and the lemmy filter is made to work with the default lemmy.world web UI and may not work on other UIs without tinkering.

Yes, I know I’m just hiding my head in the sand

  • Dieva@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    3 minutes ago

    this didn’t work on firefox + ublock, it blocked every article on the page when a keyword showed up

  • Goretantath@lemm.ee
    link
    fedilink
    English
    arrow-up
    3
    ·
    6 hours ago

    Yeah i think you can block EVERYTHING a webpage has with uBlock, the sky is the limit.

  • Optional@lemmy.world
    link
    fedilink
    arrow-up
    8
    ·
    8 hours ago

    Fwiw, Voyager has a filters & blocks section that makes this even easier. Keywords, instances, users, etc. And just as easily reversible if you change your mind.

    • AnActOfCreation@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      5 hours ago

      Thunder too! Instance/community/user blocks are a Lemmy feature, but keyword blocks are just a client side thing for now. Thunder blocks based on post titles, contents, and links.

  • Alteon@lemmy.world
    link
    fedilink
    arrow-up
    23
    ·
    11 hours ago

    I can’t afford to do this. Just stick my head in the sand. It sounds wonderful, but for the sake of my friends and family, I need to know these things.

    • Opinionhaver@feddit.uk
      link
      fedilink
      English
      arrow-up
      10
      ·
      8 hours ago

      You could reduce your news consumption by 95%, and you’d still “know these things.” There’s no avoiding them - trust me, I’ve tried. Nobody is obligated to consume the sheer volume of news your average Lemmy user currently does. At this point, I’d practically consider it a form of self-harm. The only way to maintain anything remotely resembling a healthy media diet nowadays is by actively limiting your exposure to the overwhelming flood of information.

      • chingadera@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        6 hours ago

        I’ve put a filter on the usual suspects directly within Voyager and I still see a crazy amount of it. My page isn’t completely full of it like it was, but it is drastically reduced while also letting enough in that I’m still keeping up with it.

      • Alteon@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        8 hours ago

        I’m constantly contacting my politicians, protesting at every protest, and trying to fight facism every legal way that I can. This sucks, but I can’t afford to avoid news because it’s a bummer.

        Avoiding news and current events is why we have such ignorant people, people not voting, and why we’re dealing with this shit in the first place.

        • surewhynotlem@lemmy.world
          link
          fedilink
          arrow-up
          4
          ·
          7 hours ago

          I really wish there was a way to consume news in a daily update. This drip feed of often redundant chaos is exhausting.

          Maybe newspapers were a good idea…

    • justsomeguy@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      10 hours ago

      You really don’t. Apart from the core things that you’d hear despite any filter you could possibly implement, most of it is just noise to “flood the zone” as they call it.

    • 58008@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      6 hours ago

      True, but the post title still needs to have text, and hopefully people will be decent enough to accurately describe the content/topic (if only for accessibility reasons). If someone is doing this all the time to circumvent people’s personal block lists, they themselves will likely get blocked 👀

      • Goretantath@lemm.ee
        link
        fedilink
        English
        arrow-up
        3
        ·
        6 hours ago

        People aren’t, theres tons of images on bluesky not tagged correctly so they slip through my blacklist, why would it be any different anywhere else on the web?

  • zkfcfbzr@lemmy.world
    link
    fedilink
    English
    arrow-up
    14
    ·
    11 hours ago

    What an insightful post 🙂

    The only one of these I’ve updated since the original is the one for Ars Technica, which is now this:

    arstechnica.com##:not(:not(head>title:has-text(/Serving the Technologist/))) article:has-text(/Trump|Elon|Musk|nazi|doge|maga/i)

    The reason being that ‘Ars Technica’ now appears in the title of articles, while it didn’t originally, which caused the original filter to block out entire articles. ‘Serving the Technologist’ only appears on the homepage so this updated filter will still filter the homepage but display the contents of articles that contain blacklisted words.

  • Opinionhaver@feddit.uk
    link
    fedilink
    English
    arrow-up
    12
    ·
    12 hours ago

    And for blocking comments:

    feddit.uk##article.comment-node:has(div.comment-content:has(p:has-text(/Trump/i)))

  • Skull giver@popplesburger.hilciferous.nl
    link
    fedilink
    English
    arrow-up
    2
    ·
    10 hours ago

    How is performance in has-text() these days? Last time I checked it was slow enough that I didn’t bother adding it to things like ad blockers because it bogged down websites.