TOCPilot — Table of Contents

Description

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.

Blocks

This plugin provides 1 block.

  • Table of Contents A live table of contents built from your content headings.

Installation

  1. Upload the tocpilot-table-of-contents folder to /wp-content/plugins/, or upload a ZIP containing that folder through Plugins Add New Upload Plugin.
  2. Activate TOCPilot — Table of Contents through the Plugins screen.
  3. Visit Settings TOCPilot and select the post types and heading levels to process.
  4. View a post or page with at least three H2–H4 headings, or manually insert the Table of Contents block or [tocpilot] shortcode.

FAQ

Does TOCPilot change my saved content?

No. Heading IDs and automatic tables of contents are added only when WordPress displays the main content on a singular view of an enabled post type. No post content or post metadata is written. Deactivating the plugin removes its automatic output without changing your posts.

Where do automatic tables of contents appear?

On the main content of individual posts and pages by default. Select additional public post types in Settings TOCPilot. Archives, feeds, and REST responses are not processed by the content filter. Enable a post type there to receive heading anchors, including when placing a block or shortcode manually.

Can I turn off automatic insertion and keep the block or shortcode?

Yes. Turn off Auto-insert and leave the desired post types enabled. TOCPilot still adds the heading IDs needed by your manually placed tables of contents.

Why is there no table of contents?

Check the selected post type, heading range, and automatic minimum heading count. Manual placement bypasses the minimum count but still requires at least one heading within the selected range and any block or shortcode depth cap. Password-protected content is not exposed before it is unlocked.

Can I use the classic editor?

Yes. Automatic insertion and the shortcode read H1–H6 elements in classic content. Gutenberg content is collected recursively from saved Heading blocks.

What happens to custom anchors?

Existing nonempty heading ID attributes are left unchanged. Headings without an anchor get an ID based on their text. Repeated generated IDs receive suffixes such as -2 and -3. Use distinct custom anchors when editing your headings.

Can I have more than one table of contents?

Yes. Multiple blocks or shortcodes can use different titles or depth caps. Their links use the same heading IDs and each collapse button controls its own list.

Does the plugin contact external services?

No. It makes no external HTTP requests, sends no telemetry, and requires no account. Assets are served from your own WordPress installation.

What happens when I uninstall it?

Uninstalling deletes the tocpilot_settings option. Saved posts and pages are not modified. Any blocks or shortcodes you placed yourself remain in the saved content and can be removed in the editor.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“TOCPilot — Table of Contents” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

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.