Blocking Spam Websites from Google Search in Firefox

Whenever I try to use Google to look up a programming or tech related problem, my search results are often filled with useless spam. Most of them are either low-effort blogspam tutorials *ahem* or are just GitHub or Stack Overflow mirrors. It's unfortunate that despite me constantly clicking and immediately bouncing back, they still rank quite high in search rankings. In addition, Google also does not allow me to block certain websites from my personal search results.

Luckily, there is a little known feature in Firefox that allows us to create our own search engine using bookmarks. Bookmarks in Firefox can be aliased to a shortcut so that it can be quickly accessed by typing the alias in the search bar. In addition, we can also type additional text after the alias which will get substituted into our bookmark URL with the %s variable.

We can create a custom Google search engine by creating a bookmark in Firefox with a short keyword and point to https://www.google.com/search?q=%s
Afterwards we can use our custom search engine by simply prefixing our queries with g in Firefox's search bar
Our search results now automatically excludes all the spam websites

Search Url

Here is the actual URL that I use for my personal bookmark. Feel free to use it as is or edit it to suit your needs.

https://www.google.com/search?q=%s+-medium.com+-quora.com+-dev.to+-dzone.com+-issuehunt.io+-fossies.org+-csdn.net+-gitcom.org+-adoclib.com+-aliyun+-gitmemory+-codegrepper+-bleepcoder+-githubmemory+-programmersought+-semicolonworld
medium.com
quora.com
dev.to
dzone.com
issuehunt.io
fossies.org
csdn.net
gitcom.org
adoclib.com
aliyun
gitmemory
codegrepper
bleepcoder
githubmemory
programmersought
semicolonworld