Table of Contents

An easy and flexible way to show your readers a clickable structure of your document

Table of Contents

A bring your own html” flat structure to create links to important sections in your document

How to use #

Table of contents are currently part of the Doxter field API. That means that you won’t be able to take adventage of table of contents unless you’re using the Doxter Field.

To generate a table of contents for your document, use the toc method available in your Doxter field.

Here is a quick example of how you could use the generated table of contents for your sidebar.

{% set tableOfContents = entry.doxterFieldHandle.toc %}

{% set sidebarContent %}
    {% for item in tableOfContents %}
        <a href="{{ item.hash }}">{{ item.text }}</a>
    {% endfor %}
{% endset %}

TOC Model #

Each item in the table of contents is an instance of TocModel

Public Properties

  • id (string)
  • text (string)
  • level (int)

Accessor Methods

  • getUid (string)
  • getHash (string)

[Work In Progress]

Please forgive my typos, partial docs, and overall mess.

I'm working hard to get everything moved over and provide amazing docs for you, my loyal supporter.

—Selvin Ortiz

Let’s Work Together

If you’d like to work together, have questions about any of my Craft CMS Plugins or just want to say hello, send me an email.

Email Me