How to add table of contents

Hello,

How do I add table of contents to my blogs?

Hi Ryan,

Thank you for reaching out to us. There are helpful references you can take a look at such as the shortcode demonstrations on the demo installations. Make sure to read through as they will help walk you through various features of the shortcodes.

Regarding the table of contents shortcode, this only works with paginating pages and posts using the <!--nextpage--> tag. What happens when you use this tag on your pages or posts in WordPress is that WordPress will break your post out into multiple pages, and for each successive page, it will append a higher number to the page or post URL. For example, a our table of contents example post is broken down into three pages using the tag twice, resulting in an output like this:

Each [toc_item] item you add will take the number you input from the page attribute and append it to your posts URL. So, if your post URL is https://demo.theme.co/integrity-1/shortcodes/table-of-contents/ and you enter in a table of contents item like so, [toc_item title="Page Two" page="2"] , it will link out to https://demo.theme.co/integrity-1/shortcodes/table-of-contents/2/.

Additionally, You will need to display your whole [toc] block on each page of your post after each <!--nextpage--> tag. So, it should look something like this:

[toc type="left"]
[toc_item title="1. Introduction" page="1"]
[toc_item title="2. More Information" page="2"]
[toc_item title="3. Even More Information" page="3"]
[/toc]

...Content for the first page here...

<!--nextpage-->

[toc type="left"]
[toc_item title="1. Introduction" page="1"]
[toc_item title="2. More Information" page="2"]
[toc_item title="3. Even More Information" page="3"]
[/toc]

...Content for the second page here...

<!--nextpage-->

[toc type="left"]
[toc_item title="1. Introduction" page="1"]
[toc_item title="2. More Information" page="2"]
[toc_item title="3. Even More Information" page="3"]
[/toc]

...Content for the third page here...

Hope this explains!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.