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

December 1st, 2015 | Posted by Marijn in design | enterprise2.0 | jquery / javascript | SharePoint 2013

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.


You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

Leave a Reply

%d bloggers like this: