Posts and authors

Table of Contents

The Table of Contents block lists the headings of the post a reader is on. Clicking a heading in the list scrolls to that part of the post. It builds itself for each post or page from the headings you write in Ghost Admin. It goes only in a Post Content section, the section that shows the post's text on the Post and Page templates, usually in that section's sidebar. You find it in the Content group of the block picker when you add a block to a Post Content section.

A post's opening paragraph and a photo, with a table of contents in a sidebar on the right listing What Is Slow Living and its subheadings, indented

The With Sidebar pattern for posts already holds one. Design your post pages shows how to set up a post page with a sidebar.

General

Setting What it does
Headings Which heading levels the list holds: H2, H2 + H3 (the default) or H2 + H3 + H4. Lower levels are indented under the heading above them. Only headings in the post's text count. Two headings with the same text each get their own link.
Highlight Active Link On by default. Marks the heading of the part the reader is on in darker, heavier text as they scroll.
Collapse on Small Screens On by default. When the section is narrower than 1024 px, the sidebar hides and the table of contents moves above the post. With this on, it shows there as one closed bar that opens on tap. Off, it shows open, as a full list.

A heading above the list

Put a Heading block right before the Table of Contents to give the list a title, such as "In this post". The heading hides together with the list when a post has no headings. On small screens, the heading's text becomes the label of the closed bar. Without a heading, the bar reads "Table of contents".

Posts without headings and locked posts

On a post with no headings of the chosen levels, the block shows nothing. When it is the only block in the sidebar, the post then takes the full width. On a locked post, the list holds the headings of the part readers can see, if any, and ends with an Unlock full content link that scrolls to the paywall.

Shared settings

The Table of Contents also has Width from the Layout settings, the Display settings and the Advanced settings.

Was this article helpful?