Mavention Insert Table of Contents

Mavention Insert Table of Contents is a Sandboxed Solution that allows you to automatically insert a Table of Contents for your page based on its contents. Upon installation of the Solution a new button is added to the Ribbon’s Content group on the Insert tab:

After clicking the Insert Table of Contents button, the contents of the active Rich HTML fields are scanned, and a Table of Contents is generated based on the headers’ structure. The generated TOC contains only links to level 2 headers. Since the level 1 header is reserved for the title of the current page which should be located outside the Rich HTML field, level 2 is the first level within the page content used for structuring the content. Once generated, the TOC is being inserted at the cursor position.

The generated Table of Contents is being rendered as an ordered list (OL). In my example I’ve used the following CSS snippet to style the TOC:

#toc {
    float: right;
    border: 1px solid #ccc;
    background: #eee;
    color: #666;
    padding: 0.5em;

#toc p {
    font-weight: bold;

And that’s it: using the Mavention Insert Table of Contents Solution you can generate a TOC for your page with a single mouse click. And if you ever change the structure of your content, you can simply remove the old TOC and generate the new one.

Download: Mavention Insert Table of Contents (2KB, WSP)

Technorati Tags: SharePoint 2010,WCM