Limit the amount of newsfeed posts shown in a SharePoint 2013 site

For some SharePoint sites, the newsfeed functionality is used quite heavily. This could result in an extensive list that pushes other webparts below them under the fold. For one of my customers I was looking for a solution to limit the amount of newsfeed posts shown to 3.

Googling for an answer showed me a lot of requests, some answers but only a few usable things. This post on StackExchange did it for me: a 2 line jquery code solution where you can set the amount of newsfeeds.


$('.ms-microfeed-thread:gt(2)').hide(); //hides all posts after the three latests
$('#ms-MoreThreadsButtonLabel').click(function (){$('.ms-microfeed-thread').show();}); // sets a click

How this code works

This code will run when your page is loaded. It will count the amount of microfeed threats there are (1 thread is a post with all replies). It will stop after the amount of gt(x) and hide all the rest. Note: it starts counting at 0.

The next line of code will make sure the “show more posts” button is shown.

The result is going from this:

newsfeed - start list
newsfeed – start list

To this:

newsfeed - result
newsfeed – result

Implementing the newsfeed post amount limiter

So, how can you get it to work: simply throw this code (with supporting script tags) in the site assets of your SharePoint site. Copy the url and go to the page where your newsfeed is shown (probably the main page of your site). Edit the page and add a content editor webpart on the bottom of the page. Edit the webpart and add the url to the script on it. Save the changes and the amount of newsfeed items should now be the limit you have set.


About: Marijn

Marijn Somers (MVP) has over 14 years experience in the SharePoint world, starting out with SP2007. Over the years the focus has grown to Office 365, with a focus on collaboration and document management. He is a business consultant at Balestra and Principal Content Provider for "Mijn 365 Coach" that offers dutch employee video training. His main work tracks are around user adoption, training and coaching and governance. He is also not afraid to dig deeper in the technicalities with PowerShell, adaptive cards or custom formatting in lists and libraries. You can listen to him on the biweekly "Office 365 Distilled" podcast.

%d bloggers like this: