Table of Contents

In this article

This block is experimental and may change or be removed without notice.

Summarize your post with a list of headings. Add HTML anchors to Heading blocks to link them here.

  • Name: core/table-of-contents
  • Category: design
  • API Version: 3
  • Block Type: Dynamic (server-rendered)
  • Keywords: document outline, summary

Attributes

Defined via the attributes property in block.json.

Attribute Type Default Description
onlyIncludeCurrentPage boolean false —
maxLevel number — —
ordered boolean true —

Supports

Defined via the supports property in block.json.

Context

Defined via the usesContext and providesContext properties in block.json.

Uses context:

  • postId
  • postType

Block Markup

This is a dynamic block. It is rendered on the server and does not save HTML in post content.

In post content, it is stored as a block comment:

<!-- wp:table-of-contents {"maxLevel":3,"ordered":false} /-->

Source