144

I was going to make a filter for the "Hot Network Questions" by excluding some sites from it. I noticed this answer which talks about "negative filtering" but does not explain how one can do it or if it is possible. There does not seem to be a way to do this, though. On the filter page, my only options are:

on...

So how can I do "All sites except [list]"?

It would also be nice if this could include similar functionality with the meta checkbox. Something like "All main & meta sites except..."

14
  • The post you linked to is a declined feature request, the answer is just a suggestion that was never implemented. The filter page you posted a screenshot from is also not relevant, it's about all questions not hot questions. Mar 13, 2014 at 15:10
  • 1
    @ShadowWizard My apologies for not knowing how to do it. Could you point me in the right direction? Mar 13, 2014 at 15:12
  • 2
    No problem, you did the right thing here by posting new feature request. I was just clarifying some points you seemed to miss. Mar 13, 2014 at 15:13
  • 2
    @ShadowWizard The filter page was accessed from the Hot Questions page by clicking the link in the text "Create a filter to pick just the topics you want to see..." located on the right of the page. If this link is wrong, it should probably be fixed as well. Mar 13, 2014 at 15:18
  • Yes, noticed this. The wording can indeed be confusing for those not familiar with the hot questions/filters concepts. You can start new feature request asking to change the wording, ideally giving your own idea. You'll have my support. :-) Mar 13, 2014 at 15:30
  • 2
    @Downvoter: While I respect the ability to be anonymous, I appreciate feedback so I can better not only this question but all future posts I make. If you would be kind enough to elaborate on your reason for the down-vote, I would appreciate it. May 2, 2014 at 16:33
  • For exlcuding sites from the filters (and not the Hot questions), see Excluding a set of sites from a filter.
    – unor
    Jan 14, 2015 at 5:36
  • I hope this is picked up again. I wish there was at least a setting to only show sites you're a member of.
    – user354226
    Apr 11, 2017 at 20:00
  • 1
    Is there a way of restarting the debate around this? It is getting ridiculous with Game of Thrones spoilers. Aug 8, 2017 at 12:33
  • @user2891462 I'm not sure. There was a bounty offered on it to try to get more attention drawn to it, but nothing happened with that. You might try commenting on Jeremy T's answer to ping him. Or maybe try bringing it up in a chatroom? Aug 8, 2017 at 12:54
  • 1
    Why do sites which I'm not a member of, show up in 'Hot Network Questions' at all? If I'm not a member, they are simply not part of my 'network'. Worldbuilding and gaming may be fascinating but are irrelevant to me. I find the subject lines distracting and occasionally wander off and waste way too much time reading bits of them.
    – Ed Randall
    Apr 24, 2018 at 6:03
  • @EdRandall I'm not sure. This answer suggests you should not be seeing sites you have no account with. You might think about asking a new question about it. Apr 24, 2018 at 14:33
  • @DavidStarkey not relevant. That answer is about "Filtered Questions" which is not the hot questions list, but rather something totally different. May 28, 2023 at 7:16

7 Answers 7

29
+50

For those that do not want to wait for an official version, I made a short GreaseMonkey script that will hide sites you specify. Use this page to get the official names to use when setting the "ignore" variable. Multiple sites should be separated by a comma (,) and it works best if you avoid putting more than 1 space after commas.

// ==UserScript==
// @name        Hide SE site from Hot Questions
// @namespace   stackexchange
// @description Hide certain Stack Exchange sites from the Hot Network Questions list.
// @include     *stackoverflow.com*
// @include     *superuser.com*
// @include     *serverfault.com*
// @include     *askubuntu.com*
// @include     *stackapps.com*
// @include     *mathoverflow.com*
// @include     *.stackexchange.com*
// @version     1
// @grant       none
// ==/UserScript==

/*
For list of Stack Exchange sites, look here:
    https://stackexchange.com/sites?view=list#traffic

Put your excluded sites here under variable 'ignore'.  Example, if you want to ignore Arqade and Mathematica:
    var ignore="Arqade,Mathematica";
*/
//This is just an example list, I have nothing against these sites, they just happened to have Hot Questions when this was made
var ignore="Programming Puzzles & Code Golf, TeX - LaTeX";

var questList=document.getElementById("hot-network-questions").getElementsByTagName("li");
var curSite="";

ignore=","+ignore.replace(/, /g, ",");

for(i=0;i<questList.length;i++){
    curSite=questList[i].getElementsByTagName("div")[0].title;
    if(curSite.indexOf("Stack Exchange")>1) {
        curSite=curSite.substring(0, curSite.length - 15);
    }
    
    if(ignore.indexOf(","+curSite)>-1) {
        questList[i].style.display = "none";
    }
}

This should work in all major browsers, but I only tested in Firefox. If you have questions, leave a comment. If you have improvements feel free to edit the answer.

8
  • 3
    This works for me only if I wrap it into a setTimeout(function(){ ... }, 1000);. But it's still great!
    – RomanSt
    Sep 8, 2014 at 18:01
  • 1
    @romkyns- The reason why you have to do that is because, on page load, each list item is assigned a style of display: list-item, which overrides Greasemonkey's display:none. Another option, besides setTimeout, is to use visibility:hidden and height:0 Feb 19, 2015 at 10:11
  • @Pikamander2 interesting. I figured the list was loaded after the page through ajax or something. Good to know. Jun 9, 2015 at 15:53
  • 1
    I don't think it's working for me in Chrome even if it's wrapped in setTimeout. Dec 9, 2015 at 12:44
  • This doesn't work for me in Chrome using Tampermonkey. May 13, 2017 at 16:34
  • 2
    Note that there's Beer, Wine & Spirits so using , as the separator won't work if you want to exclude it
    – phuclv
    Aug 22, 2018 at 15:07
  • I'm using Chrome and I solved it using questList[i].parentElement.removeChild(questList[i]); i--; instead of the display = none thing. Oct 17, 2018 at 21:17
  • @Pikamander2 or simply questList[i].remove();
    – Spook
    Mar 13, 2022 at 19:44
20

I've adopted - and am very grateful for - Pikamander2's solution. My version now looks like this.

(Update: in Firefox 64, I've had to add the @require statement to include jQuery, and the @match/@exclude statements no longer work - I have to configure that from within the GreaseMonkey menu instead.)

// ==UserScript==
// @name Hide Hot Network Questions
// @version     4
// @grant       none
// @require     https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @match       *://*.askubuntu.com/*
// @match       *://*.mathoverflow.net/*
// @match       *://*.serverfault.com/*
// @match       *://*.stackapps.com/*
// @match       *://*.stackexchange.com/*
// @match       *://*.stackoverflow.com/*
// @match       *://*.superuser.com/*
// @exclude     *://api.stackexchange.com/*
// @exclude     *://blog.*.com/*
// @exclude     *://chat.*.com/*
// @exclude     *://data.stackexchange.com/*
// @exclude     *://elections.stackexchange.com/*
// @exclude     *://openid.stackexchange.com/*
// @exclude     *://stackexchange.com/*
// see http://meta.stackexchange.com/questions/225297/filter-hot-network-questions-by-excluding-sites
// and http://stackoverflow.com/questions/29682724/why-does-my-greasemonkey-jquery-script-that-hides-the-sidebar-work-on-stack-exch
// ==/UserScript==

//console.log("filtering hot network questions ...");

$.each([
  "astronomy",
  "aviation",
  "codegolf",
  "electronics",
  "gaming",
  "judaism",
  "movies",
  "photo",
  "puzzling",
  "rpg",
  "scifi",
  "space",
  "tridion",
  "worldbuilding",
  "writing"
], function(i, sitename)
{
  //console.log("excluding " + sitename);
  $(".favicon-" + sitename).parent().css('visibility', 'hidden');
  $(".favicon-" + sitename).parent().css('height', '0');
})
5
  • Though this is a helpful improvement to Pikamander2's solution, it's more of a comment on their answer then a new answer. Dec 9, 2015 at 12:51
  • 4
    I know, but it won't fit into a comment. Dec 9, 2015 at 12:54
  • 3
    @SuperBiasedMan so don't upvote, but it doesn't need to be deleted. (So VLQ/NAA flag isn't proper) Dec 9, 2015 at 13:15
  • When I have this enabled, the upvote button no longer works..? Dec 27, 2019 at 11:58
  • 1
    Thank you. For anyone else who wants to avoid the weird gaps this script leaves in place of the removed questions: I've changed mine to use .remove() instead of the two .css() calls.
    – Keiji
    Feb 27 at 18:31
8

Using Greasemonkey or Tampermonkey:

// ==UserScript==
// @name        Hide Hot Network Questions
// @namespace   GreaseMonkeyStackOverflow
// @description Hides certain Hot Network Questions on Stack Overflow
// @include     https://stackoverflow.com/*
// @include     https://*.stackexchange.com/*
// @include     https://superuser.com/*
// @include     https://serverfault.com/*
// @include     https://mathoverflow.com/*
// @version     1
// @grant       none
// ==/UserScript==

function block_hot_network_questions()
{
    let sites_to_block = ["gaming", "politics"];

    let hot_network_questions = document.querySelectorAll('#hot-network-questions ul li');

    hot_network_questions.forEach(function(element)
    {
        //Convert "favicon favicon-gaming" to "gaming"
        let question_site = element.querySelector('div.favicon').className.replace('favicon favicon-', '');

        if (sites_to_block.includes(question_site))
        {
            element.remove();
        }
    })
}

block_hot_network_questions();

Replace favicon-gaming with the favicon class name for whatever StackExchange website you don't want to see on the list.

0
3

In the case you are only willing to install CSS override plugins as opposed to full userscript editors, you can still adjust the the sites shown in the HNQ.

This is possible, because every site has its own favicon, loaded from a global sprite-sheet, and thus every icon has an unique class.

If you want to block the site codereview, you can use inspect element on its favicon, and then copy the class. The insert a css rue like the following using your favorite CSS injector ( I can personally recommend Stylus):

#hot-network-questions .favicon.favicon-codereview,
#hot-network-questions .favicon.favicon-codereview + a {
    display: none;
}

Based on my previous answer on SO meta

2

It’s kind of fascinating to observe how JavaScript, libraries and DOM APIs have changed over time through the lens of those scripts.

Anyway, here’s my version:

// ==UserScript==
// @name     StackExchange: filter Hot Network Questions
// @version  1
// @grant    none
// @match    https://*.stackexchange.com/*
// @match    https://*.superuser.com/*
// @match    https://*.stackoverflow.com/*
// @match    https://*.mathoverflow.net/*
// @match    https://*.serverfault.com/*
// @match    https://*.askubuntu.com/*
// @match    https://stackapps.com/*
// @exclude  https://chat.stackexchange.com/*
// @exclude  https://api.stackexchange.com/*
// @exclude  https://data.stackexchange.com/*
// @exclude  https://openid.stackexchange.com/*
// @exclude  https://area51.stackexchange.com/*
// @exclude  https://stackexchange.com/*
// @exclude  https://contests.stackoverflow.com/*
// @exclude  /^https?:\/\/winterbash\d{4,}\.stackexchange\.com\//
// ==/UserScript==

const IGNORED_SITES = {
  'codegolf.stackexchange.com': true,
  'puzzling.stackexchange.com': true,
  'hermeneutics.stackexchange.com': true,
  'codereview.stackexchange.com': true,
  'rpg.stackexchange.com': true,
};

for (const hnq of document.querySelectorAll('#hot-network-questions > ul > li')) {
  const url = new URL(hnq.querySelector('a[href]').href);
  if (IGNORED_SITES[url.hostname]) {
    hnq.remove();
  }
}
0

The other answers are already sufficient, but I thought I'd add another technique to the list:

You can do this with a userscript / userstyle with CSS using the following technique:

#hot-network-questions li:has(a[href^='https://stackoverflow.com']) {
  display: none;
}
-8

We have something along these lines in the hopper to test in the next few weeks.

Sorry, I totally misunderstood the question.

We're going to try some algorithm changes to the hot network questions which will try to guess which sites you like and don't like, and give you more of the sites that you like.

The right sidebar on the hot network questions page is just a way to create filtered questions lists. It really doesn't have anything to do with the hot network questions and I agree it's confusing. It's been that way for a long time, but we'll see if we can make it clearer.

14
  • 2
    Will it be done via the sidebar, or the full list of hot questions? Mar 13, 2014 at 15:31
  • Just the hot network questions for now.
    – Jeremy T
    Mar 13, 2014 at 15:32
  • 8
    I'll put my vote in for the sidebar too, there are some sites I'd ideally not like to see Mar 13, 2014 at 15:36
  • 1
    OK, what about the wording in the right sidebar of the hot questions page, you agree it's misleading? At least two users thought it means filtering the hot questions. Mar 13, 2014 at 15:39
  • 7
    The request here is to manually filter the sites, algorithm that try to guess... doesn't sound very good to be honest. Mar 13, 2014 at 15:56
  • 10
    "guess which sites you like" - oh no, this likely means more hordes of passers-by from hot list that just happen to liek c00l stuff at softer sites like Workplace and Programmers, with their senseless answers and votes. As if we didn't have enough damage already. You'd better redirect them to Stack Overflow, where it's claimed to be an issue of -17 priority
    – gnat
    Mar 13, 2014 at 17:44
  • 1
    It would really be better if we could still have this feature, even if you mess with the algorithms in addition. After all, some users might just like to see the odd questions Arqade asks, but not be all that interested in gaming. Mar 13, 2014 at 17:54
  • 6
    Regards "We're going to try some algorithm changes to the hot network questions which will try to guess which sites you like and don't like, and give you more of the sites that you like.", how about implementing the same thumbs up/thumbs down voting you have for the ads? This way you don't have to guess; users will just tell you which sites they do/don't like to see. Personally, I'd like to be able to turn the whole thing off as I find it distracting, but maybe that's just me.
    – DeanOC
    Mar 18, 2014 at 0:35
  • 1
    @gnat: You posted that complaint in completely the wrong place, which is why it was downvoted as irrelevant to mods. Nov 17, 2015 at 22:27
  • @Oddthinking I posted it in the right place because I wanted to learn if it's important or not for SO. There's nothing inherently irrelevant there; for comparison, moderators at many smaller sites worry about HNQ. It's just that bunch of funny "site-specific adjustments" in hotness calculation makes it less of an issue at SO compared to other sites. I wanted to learn how much less it is and I learned that
    – gnat
    Nov 17, 2015 at 22:33
  • @gnat: Let's go to chat. Nov 17, 2015 at 22:38
  • 4
    Whatever algorithm ever got built doesn't work well. I've had it with puzzling and want it off the list for me.
    – Joshua
    Jan 24, 2018 at 20:27
  • @Joshua no algorithm was ever really used, that's something Jeremy wanted to try, but didn't have the chance to. Feb 5, 2018 at 7:51
  • 2
    A site I haven't even joined consistently shows up in my hot network feed. (codegolf.stackexchange.com , if it makes a difference.) I'd love to see a way to get rid of this noise. This happens on my laptop browser (where I could potentially use a filter script), in the mobile app, at work where I browse as an anonymous guest...
    – arp
    Jun 3, 2018 at 16:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .