Norwegian version of this page

Table of contents

The component generates an automatically updated table of contents of headings in the document. It lists headings with the format "Heading 2" (h2) or "Heading 3" (h3) at the beginning of the content field. The table of contents consists of jump links that take the user directly to the selected heading.

How an automatic table of contents work

Table of contents is used for long documents where it is important for users to get a quick overview of the content and be able to jump to the desired section. Examples are user guides or long case documents.

Example of a table of contents used on uio.no

Skjermdump av en innholdsfortegnelse som eksempel p? komponenten
Screenshot of a table of contents used on uio.no

How to add a table of contents

  • Create the document with formatted headings
  • Copy the code
  • Paste the code at the top of the document
$<slettmeg>{resource:toc}

NOTE! Remove "<slett meg>" in the code to make the code work.

Change title

The title is automatically set to "Table of contents". If you want another title, enter "title=[nytittel]" after "${resource:toc" - like this:

  ${resource:toc title=[Dagsorden]}

List of Heading 2 only

You can make the component that creates an automatic table of contents for only the top level of headings "Heading 2" by adding the component like this:

<div class="vrtx-toc-only-one-level">
  ${resource:toc}
</div>

Change the font size

There are some special clauses you can add to source code to control the appearance of the table of contents.

Reduce the size of headings of table of contents from h2 to h3
 <div class="vrtx-toc-style-like-h3">
    ${resource:toc}
</div>
Reduce the size of headings of table of contents from h2 to h4
<div class="vrtx-toc-style-like-h4">
    ${resource:toc}
</div>
Published Jan. 25, 2022 7:08 AM - Last modified Mar. 4, 2022 10:33 AM