-
-
Save jaydorsey/d728423051fbcb54f1abd53ed3920c9e to your computer and use it in GitHub Desktop.
| # 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')]]/../../../..) |
A side-note & warning:
(www.)linkedin.com##li:has-text
also affects other pages on LI, not just the jobs listing panel.
(Found this out the hard way, when my profile page was missing all but one of my job 'Experience'!)
For example, you probably do not want to use generic terms like,
linkedin.com##li:has-text(Information)
I guess there is no element(s) specific to the listing panel, so the filter is the best available for now.
(I'm using Firefox, so maybe that's the underlying problem.)
It seems to work in this format linkedin.com##li:has-text(Information) on Firefox, but this was not the case for Chrome. I just wanted to point this out for others who may stumble upon this issue.
Since I use Firefox most of the time, I didn't run into any issues, but I have yet to test other filters. So others may have to determine what works for them through trial and error.
The issue ... is that neither
**www**.linkedin.com##li:has-text(/, (AL|AK|AZ|AR|AS|BC|CA|CO|CT|DE|DC|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|MP|OH|OK|OR|PA|PR|RI|SC|SD|TN|TX|TT|UT|VT|VA|VI|WA|WV|WI|WY)/):has-text(/\(On-site\)|\(Hybrid\)/)norlinkedin.com##li:has-text(/, (AL|AK|AZ|AR|AS|BC|CA|CO|CT|DE|DC|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|MP|OH|OK|OR|PA|PR|RI|SC|SD|TN|TX|TT|UT|VT|VA|VI|WA|WV|WI|WY)/):has-text(/\(On-site\)|\(Hybrid\)/)work -- for me.That is what I was wondering, if those 2 lines in previous post work for others. (I'm using Firefox, so maybe that's the underlying problem.)
Current solution is to break apart the long string into individuals:
www.linkedin.com##li:has-text(/, TX/) -- block all posts for Texas location
www.linkedin.com##li:has-text(TX (Hybrid))
www.linkedin.com##li:has-text(TX (On-site))
-- using both of these together will show only (Remote) posts
{Nothing personal again Texas, haha}
Amazing ! thank you :)
Would love a Linkedin poll filter too :)
I made a few updates:
- Clean up some of the syntax errors ublock was showing. I needed to change some single quotes to double quotes, then escape the whole xpath string with single quotes to make it work
- Added some additional filters to clean up the excessive AI contribution spam that LinkedIn recently added ("Expert answers on")
I spent some time with these rules today. Some items seems to be nested at new levels - I'm not sure if that's consistent across browsers/devices, but this is when I ended up with.
Edit: I scoped the rules to the /feed page... I think the only thing that is broken now is when I view my own posts...
Content rules
linkedin.com##:matches-path(/feed):xpath('//[(text()[contains(., "Suggested")])]/../../../../../../../../../..')
linkedin.com##:matches-path(/feed):xpath('//[(text()[contains(., "Expert answers on ")])]/../../../../../../../../../..')
linkedin.com##:matches-path(/feed):xpath('//[(text()[contains(., "Recommended for you")])]/../../../../../../../../../..')
linkedin.com##:matches-path(/feed):xpath('//[(text()[contains(.,"Events recommended for you")])]/../../../../../../../../../..')
Promoted
linkedin.com##:matches-path(/feed):xpath('//*[(text()[contains(.,"Promoted")])]/../../../../../..')
Reactions
linkedin.com##:matches-path(/feed):xpath(//span[text()[contains(.,'likes this')]]/../../../../../../..)
linkedin.com##:matches-path(/feed):xpath(//span[text()[contains(.,'celebrates this')]]/../../../../../../..)
linkedin.com##:matches-path(/feed):xpath(//span[text()[contains(.,'loves this')]]/../../../../../../..)
linkedin.com##:matches-path(/feed):xpath(//span[text()[contains(.,'finds this insightful')]]/../../../../../../..)
linkedin.com##:matches-path(/feed):xpath(//span[text()[contains(.,'finds this funny')]]/../../../../../../..)
linkedin.com##:matches-path(/feed):xpath(//span[text()[contains(.,'supports this')]]/../../../../../../..)
2nd connections
linkedin.com##:matches-path(/feed):xpath(//span[text()[contains(.,' • 2nd')]]/../../../../..)
Remove the right side bar
linkedin.com##.scaffold-layout__aside
Remove premium elements
linkedin.com##.text-align-left.link-without-hover-state.t-bold.t-black.t-12.feed-identity-module__anchored-widget--premium-upsell.feed-identity-module__anchored-widget.link-without-visited-state.app-aware-link
linkedin.com##.premium-upsell-link--extra-long.premium-upsell-link--truncate.global-nav__spotlight-upsell.global-nav__primary-link--premium.global-nav__primary-link.link-without-visited-state
Remove the "for business" modal from the nav
linkedin.com##.pr3.global-nav__app-launcher-trigger.pl3.global-nav__primary-item--divider.global-nav__primary-link
CSS alterations
linkedin.com##:matches-path(/feed)header#global-nav__branding-logo:style(margin-left: 4 !important)
linkedin.com##:matches-path(/feed)header#global-nav:style(padding-left: 0 !important)
linkedin.com##:matches-path(/feed)header#global-nav:style(padding-right: 0 !important)
linkedin.com##:matches-path(/feed)header#global-nav:style(display: flex !important)
linkedin.com##:matches-path(/feed)header#global-nav:style(justify-content: center !important)
linkedin.com##:matches-path(/feed)header#global-nav__content:style(width: 1000px !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout:style(display: flex !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout:style(justify-content: center !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__inner:style(margin-top: -455px !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__inner:style(padding-top: 25px !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__row:style(display: block !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__row:style(margin-top: 0px !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__row:style(padding-left: 350px !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__row:style(padding-right: 50px !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__sidebar:style(width: 250px !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__sidebar:style(height: 455px !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__sidebar:style(position: sticky !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__sidebar:style(top: 52px !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__sidebar:style(padding-top: 25px !important)
linkedin.com##:matches-path(/feed)div.scaffold-layout__sidebar:style(margin-left: -300px !important)
From the OP, here is the list of the lines that do not break the page:
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")])]/../../../../../../../../../..')
linkedin.com##xpath('.//span[contains(@Class, "feed-shared-actor__sub-description") and text()[contains(.,"Promoted")]]/../../../..')
linkedin.com##li:has-text(Promoted)
linkedin.com##:xpath('//*[(text()[contains(.,"Promoted")])]/../../../..')
linkedin.com##:xpath(//span[text()[contains(.,'Events recommended for you')]]/../../../../../..)
linkedin.com##:xpath(//span[text()[contains(.,'Recommended for you')]]/../../../../../..)
linkedin.com##:xpath('//*[(text()[contains(.,"Today’s top courses")])]/../../../..')
linkedin.com##:xpath('//*[(text()[contains(.,"Jobs recommended for you")])]/../../../../../../..')
linkedin.com##:xpath(//span[(text()[contains(.,'Recommended for you')])]/../../../../../../../../../..)
linkedin.com##:xpath(//span[(text()[contains(.,'Events recommended for you')])]/../../../../../../../../../..)
linkedin.com##:xpath(//span[text()[contains(.,'likes this')]]/../../../../..)
linkedin.com##:xpath(//div[contains(@Class, 'feed-shared-celebration-image')])
I spent some time with these rules today. Some items seems to be nested at new levels - I'm not sure if that's consistent across browsers/devices, but this is when I ended up with.
I tested yours, it works great. I still get the "suggested posts" but I'm not sure it can be removed.
Amazing ! thank you @superresistant and @RiskTolerance
Still couldn't manage to filter out spammy polls.
I think I could use PollComponent and DynamicPollComponent :)
Going ham on ubo attempting to block Promoted posts, nothing is working. WTH?
linkedin.com##li:has-text(Promoted)
linkedin.com##li:has-text(/^Promoted$)
linkedin.com##span:has-text(Promoted):upward(6)
linkedin.com##span:has-text(/^Promoted$/):upward(8)
linkedin.com##xpath('.//span[contains(@class, "feed-shared-actor__sub-description") and text()[contains(.,"Promoted")]]/../../../..')
linkedin.com##:xpath('//*[(text()[contains(.,"Promoted")])]/../../../..')
linkedin.com##:xpath(//span[text()[contains(.,'Promoted')]]/../../../../../../../../../../..)
linkedin.com##:xpath('//*[(text()[contains(.,"Promoted")])]/../../../..')
linkedin.com##:matches-path(/feed):xpath('//*[(text()[contains(.,"Promoted")])]/../../../../../..')
linkedin.com##:matches-path(jobs/search):xpath('//*[(text()[contains(.,"Promoted")])]/../../../../../..')
linkedin.com##li:has-text(Promoted)
On the job search-results pages, this works for me - uBO 1.54.0, Firefox. In fact, I'ld go mad if it didn't.
Firefox
Is what's different. This now works, but literally no results are returned which is weird b/c it implies all posts are promoted...
amazing job! thanks !
@jaydorsey Do you want to turn this into a repo so we can submit PRs? I am also considering making a general "clean UI" stylesheet/filter list/plugin that would involve a lot more modifications.
@jaydorsey Do you want to turn this into a repo so we can submit PRs? I am also considering making a general "clean UI" stylesheet/filter list/plugin that would involve a lot more modifications.
I don't have time to manage and moderate, but I think making it a repo is a good idea.
I suspect most people found this gist via a Google search (it shows as a top result for unlock LinkedIn)
If you or anyone else wants to create a repo, I'll edit my gist with a note & add a link to it.
Thank you and all the other participants for such a helpful blocking list.
Just in case, I'm using the following subset that works at the moment I'm writing this post:
linkedin.com##li:has-text(Promoted)
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")])]/../../../../../../../../../..')
linkedin.com##:xpath(//span[text()[contains(.,'likes this')]]/../../../../..)
Copy and paste it to the uBlock's My Filters tab and click Apply changes

Hi I'm unable to see any jobs when I enable the filter to remove promoted filter. It does render again but I find jobs on very limited of those pages. Does it work on chrome
Hi I'm unable to see any jobs when I enable the filter to remove promoted filter. It does render again but I find jobs on very limited of those pages.
Blocking 'Promoted' listings on Linkedin is like that old joke:
Person: Hey Doc! Everytime I twisted arm like this, I get a terrible pain.
Doctor: Then don't do that.
The pain is Linkedin: they're pushing more&more listings to be paid ie 'Promoted'. It seems most listings already are. Who knows if/when they'll block free listings.
So don't block 'Promoted' ; instead filter on job Title, Company name or Location like I described here.
Thanks a lot for this suggestion. Appreciate it. Had to block this staffing agencies which had 100's of jobs on Linkedin. It does help me with that and make my search effective !
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!
I spent some time with these rules today. Some items seems to be nested at new levels - I'm not sure if that's consistent across browsers/devices, but this is when I ended up with.
Edit: I scoped the rules to the /feed page... I think the only thing that is broken now is when I view my own posts...
Looks like these need to be updated as I'm seeing "likes this" on my feed again.
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
@jaydorsey thanks a lot! I'll give it a try today.
! 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.
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 \&/)
Yes, both work , at least for me:
linkedin.com##li:has-text(Promoted)and
**www**.linkedin.com##li:has-text(Promoted)The issue I have is that neither
**www**.linkedin.com##li:has-text(/, (AL|AK|AZ|AR|AS|BC|CA|CO|CT|DE|DC|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|MP|OH|OK|OR|PA|PR|RI|SC|SD|TN|TX|TT|UT|VT|VA|VI|WA|WV|WI|WY)/):has-text(/\(On-site\)|\(Hybrid\)/)nor
linkedin.com##li:has-text(/, (AL|AK|AZ|AR|AS|BC|CA|CO|CT|DE|DC|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|MP|OH|OK|OR|PA|PR|RI|SC|SD|TN|TX|TT|UT|VT|VA|VI|WA|WV|WI|WY)/):has-text(/\(On-site\)|\(Hybrid\)/)work -- for me.
That is what I was wondering, if those 2 lines in previous post work for others.
(I'm using Firefox, so maybe that's the underlying problem.)