While this feature is available on many third-party apps, it’s not on the browser. However, since you’re already using an ad blocker, you can use it to filter out content as well.

To filter out posts with certain keywords, go to your custom filters and add this code. For example, to hide all posts containing the word “Elon”:

lemmy.world##div.post-listing:has(span:has-text("/elon/i"))

If your instance is something other than lemmy.world, just replace it with the correct domain.

To filter out comments, use this:

lemmy.world##article.comment-node:has(div.comment-content:has(p:has-text(/asshole/i)))

To add more keywords, simply duplicate the code and replace the keyword with another.

  • Susaga@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    14
    ·
    11 days ago

    You might want to be careful of the Scunthorpe problem when doing this, and make sure you don’t filter out posts about melons as collateral damage.

    • Viking_Hippie@lemmy.world
      link
      fedilink
      arrow-up
      10
      arrow-down
      2
      ·
      11 days ago

      make sure you don’t filter out posts about melons

      Yeah! Gotta have your melon news! That’s what we’re all here for, am I right??

      (I get what you mean and you’re right, your specific example just tickled me 😁)

      • Susaga@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        7
        ·
        11 days ago

        Of course you need melon news. You ALWAYS need melon news. I, for one, want as many big, juicy melons on my feed as possible.

        I could have said felony, but that refers to the same social group as Elon, so they’d probably want to censor it anyway.

    • undetermined@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      11 days ago

      Those filters support regex which let you distinguish between those. I use it to filter out “X” when it’s a “word” on its own.

      I like using regex101 for testing.

      • 001Guy001@lemm.ee
        link
        fedilink
        English
        arrow-up
        1
        ·
        10 days ago

        Does it work for you when the word is at the start or end of the title?

        I found that the previous/next post’s text interferes with that because it doesn’t recognize a line break between them (at least in my testing)

        • undetermined@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          10 days ago

          I didn’t notice that behavior yet but can’t confirm either. I’d need to test that too. Thanks for the hint.

    • Free_Thoughts@feddit.ukOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      11 days ago

      I think that if you add spaces around the keyword it then wont trigger if that word is contained within another word.

      Another thing to note is that the post filtering also applies to usernames.

  • undetermined@lemmy.world
    link
    fedilink
    arrow-up
    6
    arrow-down
    2
    ·
    11 days ago

    I am doing this a lot. It helps me to be careful and mindful about what content I consume. If I want to read news, I actively go to a news source of my choice. I don’t need fearmongering doom news sprinkled into my cat feed.

  • wrekone@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    2
    ·
    10 days ago

    For anyone that uses lemmy on mobile, the Voyager app for lemmy supports filters in the settings. I’m not sure how complex the filters can be. I’ve just been adding individual terms to my filter list, and it works great.