Block comments on the web

| 2 minutes | Comments

Comments on the web can be toxic, and a waste of time. Here's how to block them ...

In Firefox/Chrome, and Android #

I assume you already use uBlock Origin, and if not, then throw away whatever alternative you have, and switch to it.

On Android, uBlock Origin is supported by Firefox. If Firefox isn’t an option, there are others. At the moment of writing Vivaldi has backed-in content blocking, and supports custom filtering rules, but you might have to publish these rules, in a text file, somewhere online. Adguard might also support custom content filtering rules, although I have issues with trusting them MITM my traffic.

In uBlock Origin, add these to “My Filters” in its dashboard:

news.ycombinator.com##table.comment-tree
reddit.com##div.commentarea

youtube.com###comments

||disqus.com/embed/comments/
||disqus.com/embed.js
###disqus_thread
##.dsq-brlink
##.disqus-container

Here’s how it should look like:

Screenshot of uBlock Origin's My Filters section

These rules block comments from:

  • Hacker News
  • Reddit
  • YouTube
  • Disqus (on all websites)

Optionally, for extra sanity and street cred, also add these rules 😎

||twitter.com
||facebook.com

A short primer on the syntax …

  • Prefix CSS selectors with ##; so ##.dsq-brlink will block HTML elements with a .dsq-brlink class, and ###disqus_thread will block HTML elements with a #disqus_thread ID
    • These CSS selectors can be “generic”, meaning they apply to all websites (in the case of Disqus), or they can apply to a specific domain: e.g. ###disqus_thread is a cosmetic filter that applies to all websites, whereas youtube.com###comments filters HTML elements with a #comments ID that are shown on youtube.com
    • See relevant cheat sheet section
  • You can block specific resources from loading; a || prefix means that a domain name follows, until a separator such as /
    • A rule such as ||disqus.com/embed.js will block /embed.js on all subdomains of disqus.com
    • See relevant cheat sheet section

For more details on these rules, see this cheat sheet:
Adblock filters explained

Publish it #

You can publish this list, as a text file, somewhere, anywhere, and reuse it wherever you have uBlock Origin installed. For example, I published mine at:

alexn.org/assets/misc/block-lists/no-comments.txt

You can then import it in uBlock Origin easily:

Screenshot of uBlock Origin's Filter List

Safari / iOS (iPhone, iPad) #

Safari, on macOS and iOS, has content blockers too. Not as capable, but they do the job. An excellent one is Wipr, but it doesn’t allow setting custom rules.

If you know of a better solution, write about it in the comments section 😅😂

| Written by
Tags: Browser | Web