This article is based off Thomas Sondergaard’s post located here:

This version is slightly different, I approach it similar but in a different way. That version uses javascript and scans all <A> tags on the page, it did not remove the extra items added from Quick Launch navigation.

My version will remove all the lists and libraries as well as any nodes added from the quick launch navigation, and it specifically targets the table of contents web part only.


Standard Table of Content webpart will display all Items in the site and any additional headings and links added in the Quick Launch.


It pretty much shows everything that’s in the quick launch.


My client had the requirement of a site map type web part for SharePoint Online (o365). So I could not program anything and the Table of Content web part was great because we could sort, but they did not want all this ‘other’ stuff, Libraries & Lists & Navigation Headers, appearing in the site map type webpart. They did want it to appear in the quick launch, so I could not remove it from there. The Table of Content is reading directly from the Quick Launch navigation provider so I was stuck.


Using jQuery I iterate throught all the headers, then I find which ones are list and libraries.

Lists and Libraries will have an <a> tag which contains ‘BaseType’

Or I check to see if it’s a standard link and remove that. All the automatically generated one would be relative links. And all the ones added to the quick launch we added as absolute.

If the section did not contain a link, then it’s detected as a Header from the quick launch nav provider and I remove that.

Below is the script, I load jQuery via a CDN first. Then I’ll add this to the page in a <script></script> tag. In my actual deployment I added my script to the MasterPage so it would be used site wide.

That’s it. Your final results should look be reduced to only sites and sub sites.

  • Sharepoint Lolita
    Posted at 6:51 pm April 8, 2016
    Sharepoint Lolita

    Thanks. I lot of sites over good code but don’t deliver. You delivered! Code deployed two minutes. Satisfaction achieved. Thank you.

  • William
    Posted at 4:17 am August 24, 2015

    Hi Thomas,

    I wonder if your jQuery script is supposed to work with SharePoint 2013, I tried but nothing changes, so I am not sure the classes are exactly the same.


  • Max
    Posted at 4:45 am July 7, 2014

    Thanks much Thomas, works like a charme!

  • Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.