A “bring your own html” flat structure to create links to important sections in your document
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 %}
<ul>
{% for item in tableOfContents %}
<li>
<a href="{{ item.hash }}">{{ item.text }}</a>
</li>
{% endfor %}
</ul>
{% endset %}
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)