Exclude Pinterest from Google search results with StopTheMadness

February 2, 2023
By Jeff Johnson of Underpass App Company

I've been asked if it's possible to exclude pinterest.com from Google search results with my web browser extension StopTheMadness. Given the title of this blog post, the answer of course is yes! I'll show how to do it in desktop Safari; the method is basically the same in other web browsers, including mobile Safari.

First, add https://www.google.com/search to your site-specific website options.

StopTheMadness Add URL-specific options

Then add the following JavaScript code in the custom <script> element for https://www.google.com/search

(function() {
'use strict';
if (window !== window.top)
const search = window.location.search;
const pinterest = '-site%3Apinterest.com';
if (search.includes(pinterest))
if (search.startsWith('?q=')) {
  window.location.search =
    '?q=' +
    pinterest + '+' +
const replace = search.replace(
  '&q=' + pinterest + '+'
if (replace !== search)
  window.location.search = replace;

StopTheMadness Custom Elements

Now you can use Google Search.

Search Google in Safari

And pinterest.com is automatically excluded from the results!

Google Search -site:pinterest.com StopTheMadness

Here's my question though: why does Google list StopTheMadness as "Free"?!?

I've heard that you can use a wildcard -site%3Apinterest.* instead of -site%3Apinterest.com to exclude all Pinterest domains, but I haven't tested that myself. By the way, %3A is the URL-encoded colon (:) character.

If you're technically inclined, you might ask why I don't use StopTheMadness custom redirects to exclude Pinterest from Google search. The answer is that unfortunately Safari doesn't support regex negative lookbehind, which is required to prevent an infinite redirect. You wouldn't want to keep adding -site%3Apinterest.com to a URL that already has it, so you'd need to match only URLs that don't include it. That's why I put the matching logic in JavaScript instead of regex.

You can exclude a site other than pinterest.com in the same way. And if you know a tiny bit of JavaScript, you can exclude more than one site at the same time. I'll leave that as an exercise for the reader. ;-)