Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

TOC Twig Filter

Security covered Under active development 10 sites

This project provides a Twig filter that integrates with the TOC API to render tables of contents. It allows you to automatically generate and display a table of contents based on the content's headings, with options to customize the depth of headers included.

Twig filter rendering tables of contents via TOC API.

Usage

{% set body = content.body|render|toc %}
{{ body.toc }}
{{ body.content }}

{# OR #}

{% set body = content.body|render|toc('full') %}
{{ body.toc }}
{{ body.content }}

{# OR #}

{% set toc_options = {
  'header_min': 2,
  'header_max': 4,
} %}
{% set body = content.body|render|toc(toc_options) %}
{{ body.toc }}
{{ body.content }}
Drupal 10–11

Ask your assistant about TOC Twig Filter

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Apr 2025
Latest release
10 months ago
Releases (12 mo)
1 ▼ from 2
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
1.0.0 Stable 10–11 Nov 18, 2025
1.0.0-beta1 Pre-release 10–11 Apr 28, 2025
1.x-dev Dev 10–11 Apr 16, 2025