Skip to content

Instantly share code, notes, and snippets.

@jaydorsey
Last active January 31, 2026 02:53
Show Gist options
  • Select an option

  • Save jaydorsey/d728423051fbcb54f1abd53ed3920c9e to your computer and use it in GitHub Desktop.

Select an option

Save jaydorsey/d728423051fbcb54f1abd53ed3920c9e to your computer and use it in GitHub Desktop.
uBlock for LinkedIn
# Block things on LinkedIn with uBlock Origin that LinkedIn won't let you block
# Choose "Options" in uBlock Origin with a right-click, and add these to
# "My filters"
# ADDING YOUR OWN FILTERS
#
# Using Linkedin.com as an example
#
# 1. Open up the webpage
# 2. Find some text you want to block
# 3. Open up a console (right-click, Inspect, click the Console tab)
# 4. Using the "greedy" placeholder example, find your text
#
# $x("//*[(text()[contains(.,'YOUR TEXT HERE')])]")
#
# Click the arrow to expand the result in the console and hover over
# one of the numbered elements shown; it should highlight an element in
# the webpage
#
# The code above usually just finds the HEADER where the text is present. You typically
# want to block one of the parent elements. Which parent element?
#
# You can use the xpath parent navigator syntax to move "up" thru the parents. Just
# take what you wrote above, and keep adding a bunch of /.. values to the end. In between
# each, expand the result in your console and hover over the elements to see if you've
# moved up the tree enough to block the entire element you want
# 2023-10-07 So many recommendations from LinkedIn
linkedin.com##:xpath('//*[(text()[contains(., "Suggested")])]/../../../../../../../../../..')
linkedin.com##:xpath('//*[(text()[contains(., "Expert answers on ")])]/../../../../../../../../../..')
linkedin.com##:xpath('//*[(text()[contains(., "Recommended for you")])]/../../../../../../../../../..')
linkedin.com##:xpath('//*[(text()[contains(.,"Events recommended for you")])]/../../../../../../../../../..')
# 2020-02-24 Promoted posts
linkedin.com##xpath('.//span[contains(@class, "feed-shared-actor__sub-description") and text()[contains(.,"Promoted")]]/../../../..')
# 2023-01-23 Promoted posts (thanks @Vaansh! & @kagzgenius)
linkedin.com##li:has-text(Promoted)
# Sponsored posts (old version)
linkedin.com##:xpath('//*[(text()[contains(.,"Promoted")])]/../../../..')
# Events recommended for you 2023-03-03
linkedin.com##:xpath(//span[text()[contains(.,'Events recommended for you')]]/../../../../../..)
# Recommended for you 2023-03-03 Generic recommendation block w/ companies or pages
linkedin.com##:xpath(//span[text()[contains(.,'Recommended for you')]]/../../../../../..)
# 2021-09-24 Add to your feed
linkedin.com##:xpath('//*[(text()[contains(.,"Add to your feed")])]/../../../../../../..')
# Courses & News 2021-09-24
linkedin.com##:xpath('//*[(text()[contains(.,"Today’s top courses")])]/../../../..')
# Completely unrelated jobs that are always the exact opposite of your profile
linkedin.com##:xpath('//*[(text()[contains(.,"Jobs recommended for you")])]/../../../../../../..')
# 2022-12-06
linkedin.com##:xpath(//span[(text()[contains(.,'Recommended for you')])]/../../../../../../../../../..)
linkedin.com##:xpath(//span[(text()[contains(.,'Events recommended for you')])]/../../../../../../../../../..)
# LinkedIn News 2023-03-03
linkedin.com##:xpath(//span[text()[contains(.,'LinkedIn News')]]/../../..)
# I think this one stopped working, but leaving here for reference
linkedin.com##:xpath('//*[(text()[contains(.,"LinkedIn News")])]/../../../../../..')
# Network likes 2023-03-03
linkedin.com##:xpath(//span[text()[contains(.,'likes this')]]/../../../../..)
# Starting a new position banner image 2023-03-03
linkedin.com##:xpath(//div[contains(@class, 'feed-shared-celebration-image')])
# Facebook junk (no longer updated, I don't use facebook)
# Sponsored post garbage
facebook.com##:xpath('//*[(text()[contains(.,"Sponsored")])]/../../../..')
# Marketplace garbage
facebook.com##:xpath('//*[(text()[contains(.,"Still Available on Marketplace")])]/../../../../../..')
## Brainy game ad 2025-01-16
linkedin.com##:xpath(//p[text()[contains(.,'Take a break with a LinkedIn puzzle game')]]/../../../..)
@jaydorsey
Copy link
Author

Does anyone have a suggestion to filter out the new "Zip - a quick brain teaser" in the feed?

Here is the text:

Take a break with a LinkedIn puzzle game

Score is private to you

Zip - a quick brain teaser

Solve in 60s or less!

@hooolio I'm updating the gist w/ new rules to block these today, I have one example for "Take a break with a LinkedIn puzzle game" near the bottom of the gist, will test w/ the others but I'm guessing the rules will be same/similar

@hooolio
Copy link

hooolio commented Jan 16, 2026

@jaydorsey thanks a lot! I'll give it a try today.

@Korb
Copy link

Korb commented Jan 30, 2026

! Hides the “See curated AI tools for your job search. Get hired faster with the help of AI tools built by verified companies like …” block
www.linkedin.com##.job-details-module.jobs-details__smp-promo.artdeco-card

! Hides the “Set alert for similar jobs” block
##.job-details-module.p5.full-width.artdeco-card`

! Hides the “How your profile and resume fit this job: Show match details, Tailor my resume, Help me stand out” block
##.relative.job-details-module.p5.artdeco-card

Plus linkedin-job-spam-filter.txt by nelson-zack:

Custom uBlock Origin filter to hide recruiter spam and job board reposts on LinkedIn job search.

and by travisllado ( May 07, 2025):

www.linkedin.com##div[componentkey*="sponsoredContentV2"]:upward(div[role="listitem"])
www.linkedin.com##div[role="listitem"]:has-text(/celebrates this|celebrate this/i)
www.linkedin.com##div[role="listitem"]:has-text(/finds this funny|find this funny/i)
www.linkedin.com##div[role="listitem"]:has-text(/finds this insightful|find this insightful/i)
www.linkedin.com##div[role="listitem"]:has-text(/Jobs recommended for you/i)
www.linkedin.com##div[role="listitem"]:has-text(/likes this|like this/i)
www.linkedin.com##div[role="listitem"]:has-text(/loves this|love this/i)
www.linkedin.com##div[role="listitem"]:has-text(/other connections follow/i)
www.linkedin.com##div[role="listitem"]:has-text(/Suggested/i)
www.linkedin.com##div[role="listitem"]:has-text(/supports this|support this/i)

I noticed that LinkedIn rotates block IDs even within a single page. This means that if you block one block in element picker mode, simply refreshing the page will reveal that the IDs have changed, and the rule you added in My Filters now hides a different page element (while the old block remains). For example, this happens with www.linkedin.com###ember#️⃣, where #️⃣ is a number from at least 72 to 9694. This complicates creating rules and identifying blocks that work without rotation.

@jaydorsey, if you published your Filter list as a repo, you could provide short instructions in README.md on how to add a link to uBlock Origin. This would be useful for those who are new to this and would like to always have the most up-to-date version of this wonderful list.

@realAzazello
Copy link

FYI--- if you want to restrict filters to certain LI pages, and if you're using uBlock, can use the Procedural cosmetic filter matches-path. Adguard has an equivalent $path.

I do this because I don't want my job-filters running on the entire site. Formatting structure is shown in above link. This wiki {in German} also has some useful info and examples.

(side-note: With has-text, when using phrases with more than one blankspace or symbols, I suggest formatting the text as a regex inside of (//)--see in examples.)

Examples-- I restrict these filters to LI's job listing pages search and collections ::

linkedin.com##:matches-path(/jobs\/(search|collections)/) li:has-text(Sassafraz)
linkedin.com##:matches-path(/jobs\/(search|collections)/) li:has-text(/Expression of Interest/)
linkedin.com##:matches-path(/jobs\/(search|collections)/) li:has-text(/Network \&/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment