Toc Field

Screenshot of the Table of Contents Field configuration page.

TOC Field provides a new field type you can use to show an automatically generated Table of Contents (TOC) on any content entity.

Features

  • Add a TOC Field to any content entity type.
  • Select any of the entity's long text fields as the TOC source field.
  • Set a default TOC type per content type.
  • Override the default TOC type per entity if you want to.
  • Use the Field UI to decide when and where to show the TOC.
  • Theme the TOC Field and the TOC itself with twig templates.

The actual creation of the tables of content is handled by the toc_api module, which doesn't provide any management interface for end users other than managing types of TOC.

TOC Field on drupal.org