TOCPilot — Table of Contents
A lightweight table of contents with automatic insertion, a live Gutenberg block, and a shortcode.
Install in
TOCPilot — Table of Contents helps readers navigate long posts and pages. It builds a nested list of links from your headings and inherits your theme’s fonts and text colors.
Use automatic insertion, place the Table of Contents block in the editor, or add the [tocpilot] shortcode. A manually placed block or shortcode suppresses automatic insertion for that post.
Features
- Gutenberg-first: the editor preview updates as you add, edit, or move headings, including headings inside groups and columns.
- Classic editor support through heading extraction from HTML.
- Automatic insertion before the content or after the first paragraph.
- Choose public post types, the heading range from H1 to H6, and an automatic insertion threshold from 1 to 50 headings.
- Nested bullet lists, numbered lists, or lists without markers.
- An optional Show / Hide button; contents start expanded and remain readable without JavaScript.
- Smooth scrolling with an admin toolbar offset and support for reduced-motion preferences.
- Custom titles and a maximum heading level for each block or shortcode.
- Render-time heading anchors: saved post content is never changed.
- Existing heading anchors are preserved; generated anchors are deterministic and repeated heading titles receive numbered suffixes.
- Lightweight, dependency-free front-end JavaScript. No jQuery, accounts, tracking, external requests, or custom database tables.
Every feature is free. The plugin stores one settings option through the WordPress options API.
Usage
Open Settings TOCPilot to configure the defaults. Automatic insertion is enabled for posts and pages, includes H2–H4, and requires at least three included headings by default.
In the block editor, insert the Table of Contents block. Its sidebar lets you set a title, maximum heading level, and collapsibility. The global heading range also applies. The preview’s links and toggle are disabled while editing.
Use [tocpilot] for a manually placed table of contents. Optional attributes:
- [tocpilot title=”On this page”] uses a custom title.
- [tocpilot depth=”3″] includes headings up to H3 within the global heading range.
- [tocpilot title=”Contents” depth=”4″] combines both options.
A block or shortcode needs only one included heading, regardless of the automatic insertion threshold. With no included headings, it outputs nothing on the front end.
Written by Joobi from the project's own listing. See the source page
1.0.0
- Initial release with automatic insertion, a dynamic Gutenberg block, and the [tocpilot] shortcode.
- Shared heading extraction, deterministic anchors, nested lists, and render-time ID injection.
- Theme-inheriting styles, accessible collapse controls, smooth scrolling, and complete settings.
Follow this listing's changes (Atom feed)