Table of Contents

You are here:
Estimated reading time: 1 min

Table of Contents in articles allows your users to navigate contents quickly. MinervaKB provides two modes of ToC:

  • inside article body
  • in sidebar, as a widget

These two modes cannot be combined, you need to setup one or another (the default is inside the article body).

ToC in Article body

To enable Table of contents in article body, go to MinervaKBSettingsTable of contents and enable the following switch:

After saving the Settings the system will start searching the articles for headings and will build the ToC dynamically. All you need to do is add some headings to your articles:

The table of contents is displayed at the top of the content and looks like this:

Note, that in the earliest versions of MinervaKB the table of contents had to be built manually, using anchor shortcodes. They still work for backwards compatibility but they are not the optimal solution and might be deprecated at some point in the future

ToC as a Widget

To use table of contents as a widget, you need first to make sure your article has sidebar. Go to MinervaKBSettingsArticle and select Left or Right sidebar (you’ll probably want to make it sticky as well).

Please note, that sticky sidebar is an experimental feature and might not work as expected if your theme has non-standard layout or other sticky elements.

Next, scroll down to ToC widget settings block and enable the following switches:

ScrollSpy allows the current ToC item to be highlighted as user scrolls the page (it is optional).

Finally, after saving the settings, you need to go to AppearanceWidgets and add KB Table of contents widget to KB Article Sidebar:

That’s it, you should now be able to see ToC widget in your article sidebar (make sure it has headings).

There are many options available in MinervaKBSettingsTable of contents, you can use them to better customize ToC for your site.

Was this article helpful?
Dislike 0
Views: 28
Have questions? Search our knowledgebase.