SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any syntax that when wrapped around content, automatically builds a table of contents towards the top of the wiki, similarly to how the Media Wiki works? I am using SharePoint 2013.

share|improve this question
up vote 2 down vote accepted

Recently I updated my Add navigation table to wiki page solution to support multiple levels and SharePoint 2013.

The new solution is a configurable jquery plugin and is documented in the blog post Revised: Table of Contents for Wiki Pages

share|improve this answer

There is no OOTB capability in SP 2013 that will let you have a table of contents from a selected portion of content, however there are some nifty workarounds available mentioned below you can try it out.

Add navigation table to wiki page

SP 2010 workaround, should be valid for 2013

share|improve this answer

I've got a simpler solution that requires no deployment at all: just add a UserCustomAction with a ScriptLink by running the following in the browser developer tools console:

var sp = SP.ClientContext.get_current();
var uca = sp.get_web().get_userCustomActions().add();
uca.set_scriptBlock('{ \
function addWikiToC() {\
    var contentContainer = $(\'#contentBox div.edit-mode-border\'), \
        tocContainer = $(\'.ewiki-slink\');\
    tocContainer.append(\'<div id="pageTOC" style="margin-top:1.1em; width:250px;"><strong>Table of Contents</strong><div id="pageTOC-UL"></div></div>\');\
                    .each(function () {\
                        $(\'#pageTOC-UL\').append(\'<div style="padding-left:\'+this.tagName.replace(/h/ig,\'\')+\'em"><a onclick="javascript:$(\\\'#s4-workspace\\\').animate({scrollTop: \'+($(this).offset().top-80)+\'}, 1000)">\'+$(this).text()+\'</a></div>\');\

In this rudimentary form it only works on all enterprise wiki pages with the social rating box and builds a sequence of indented div elements below it, but it's very easy improve by changing selectors for contentContainer and styles for entries below pageTOC-UL.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.