This TechNet Wiki article shows you how to automatically add a table of contents to your Wiki article by using the "[ TOC ]" tag. You need to include headers in your article, and then the TOC tag places a table of contents that will link down to the corresponding section of your article.
If any headers have the zero character, "0", you must edit them in the HTML editor. The header text can have zeros, but after the article is saved, you must edit the <a name> tag in the header line to remove or replace all zero characters. If there are any zero characters, the header line will not appear in the Table of Contents.
If any headers are duplicates, you must edit them in the HTML editor. The header text can be duplicated in the article, but the <a name> tags must be unique. Modify the <a name> tags to ensure uniqueness.
To demonstrate the problem with duplicate headers, check the example header lines below in the next section. They are designed to demonstrate the hierarchy of headers in the resulting Table of Contents at the top of this article. However, notice that three of the headers have the text "Sample Header 3". If you test the Table of Contents at the top of this article, you will see that all three of the corresponding entries in the TOC link to the same point in this article. All three headers have the same <a name> tag.
If any headers have leading digits, such as "1" or "2", these will be ignored in the automatically generated <a name> tag when the article is saved. This means that the <a name> tag may not be unique. For example, if your article has the header line "1.2 References", and later the header line "3.1 References", the <a name> tags will not be unique. You must modify the <a name> tags in the HTML to make them unique, so the TOC will work properly. Leading digits in the <a name> tag will be ignored, but digits are allowed anywhere else in the name. For example, you could modify the <a name> tags in the example to be <a name="References_1_2"> and <a name="References_3_1">. Note that spaces and periods must be replaced by underscores.
Important Note: If your article's TOC is not showing up as expected, see below to get help and fix your TOC! ↑ Return to Top
↑ Return to Top
As you saw in the section above, your headers determine the hierarchy of the TOC (how much they are indented). Your headers automatically build out <a name=example></a> tags into the HTML, and the TOC feature uses those tags along with header number in order to determine the hierarchy in the TOC.
For example, on this article, "Feature Requests for TechNet and MSDN Profiles and Social Platform Tools" (yes, some interesting articles exist on TechNet Wiki), I used Heading 3 headers to create the top sections of each platform tool (such as Wiki, Forums, Blogs, Profiles, and Gallery). Then I used a Heading 2 to make the "Completed/Closed Requests" section at the bottom. Even though it's a higher heading, the H3s were listed first, and so the H2 below them is listed at the same hierarchical level as the H3s (this is a good thing; trust me). Then under my H2 ("Completed/Closed Requests"), I included several H3 sections for each social platform tool. This time, because those H3s were listed below the H2 section, they were indented to the right in the TOC hierarchy:
http://social.technet.microsoft.com/wiki/contents/articles/feature-requests-for-technet-and-msdn-profiles-and-social-platform-tools.aspx
So it's a fantastic and smart system! And that's one advantage that the TechNet Wiki TOC has over other Wiki TOCs... you control the hierarchy and how many levels you want!
There is no automatic way to link back to the top of your article. You can create a new anchor at the top of your article, write text, and then link to the top of your article (and then copy and paste that into the bottom of each section of your article). A faster way to do that is to copy this text and paste it in one time in your article (at the bottom of a section): ↑ Return to Top Click anywhere on the link text, click the "Insert Link or Anchor" icon on the toolbar, and update the article name in the "URL" text box (you can get it from your browser's address bar). For example, you'll want to replace "3329" with your article's ID or text name. Once you modified your "Return to Top" link, copy and paste it anywhere in your article to keep those changes you made. If you prefer having your link go up to the top text of your article (not the top of the page), then you'll need to create the anchor on your page first (click at the top, click the "Insert Link or Anchor" icon on the toolbar, click the Anchor tab, type "Top" in the Name text box, and click OK), and then change your link to point to that (click anywhere on the link text, click the "Insert Link or Anchor" icon on the toolbar, choose "Top" from the Existing Anchor list box, and then click OK). Example: ↑ Return to Top
If you're having trouble to get the TOC right, please check this article:
And if you're still having trouble:
Carsten Siemens edited Revision 48. Comment: Fixed typo
Richard Mueller edited Revision 47. Comment: More detail on digits in <a name> tags
Richard Mueller edited Revision 46. Comment: Added caution 3 about header lines with leading digits.
Richard Mueller edited Revision 45. Comment: Noted the example in this article of duplicate headers, and the effect in the TOC
Richard Mueller edited Revision 44. Comment: Added cautions about zeros in headers and duplicate headers
Peter Geelen - MSFT edited Revision 35. Comment: Added TOC troubleshooting links
Ed Price - MSFT edited Revision 34. Comment: Added the section: Hierarchy in the TOC
Ed Price - MSFT edited Revision 33. Comment: Added link to the blog
Ed Price - MSFT edited Revision 27. Comment: No longer featured on the front page. Thanks!
Peter Geelen edited Revision 26. Comment: Hey Peter. I'm just cleaning up the formatting a little. This is under your account so that it doesn't take credit from you as the author on the home page.
Ed Price - MSFT edited Revision 9. Comment: I just updated the title to guidelines.
Ed Price - MSFT edited Revision 10. Comment: Updated the See Also section to what we use for external links.
Great article, Peter! Very much needed!
Peter Geelen edited Revision 17. Comment: Congratulations Peter - your article is featured on the Wiki homepage!
That's one of my favorite features in Word for documentation. Glad to see it made its way to TechNet Wiki!
Peter Geelen edited Revision 20. Comment: This edit gives Peter credit for writing this article on the Wiki Home page.
very cool. What is the easiest way to create jumps back to the TOC so they can navigate back and foth from the TOC to a specific section in the article, rinse, repeat?
@Craig,
Okay I added a "Back to Top Link" section about the fastest manual process for that.
Very useful! I'll keep it in mind.
As you know, we're going to localize TechNet Wiki.
I was thinking about a small problem in the translation system: the "Table of Contents" header will not be translated automatically, but it will always be displayed in English language.
I can't get the toc to work correctly in this article:
social.technet.microsoft.com/.../1011.active-directory-federation-services-ad-fs-overview.aspx
Three headers are missing from the toc: "What is AD FS 2.0?", "Install AD FS 2.0", and "Manage AD FS 2.0".