Add a table of contents to a long post

ContentIntermediate~10 minUpdated

Before you start

A connected site with content reads and content writes enabled so the agent can read the post and, on your approval, update it. Update post replaces the whole body in one call, so the agent reads the raw block markup first. The agent pastes the original body into the chat before it writes, so you always have a copy to paste back.

A long guide without a table of contents makes readers scroll and guess. You know it needs one, but building it by hand means copying every heading, creating an anchor for each, and wiring the links, then redoing the whole thing the next time you add a section.

This reads the post’s headings, builds the anchored list, and drops it in at the top once you have seen it.

The prompt
Read the post at [/guides/complete-setup/] as raw block markup and add a table
of contents. Do not change anything yet.
Pull the headings in order and build a table of contents from them, with each
entry linking to its own section. Show me the list first so I can check the
headings and the order. Change nothing until I approve.
Once I approve, first paste the post's current body into your reply so I have
a copy. Then insert the table of contents near the top of the post, below the
intro, and add the anchors the links need. Do not rewrite my headings or body
copy, and do not change whether the post is published. When you are done, tell
me what you added.

Why this is safe to run

Reading the post and building the list writes nothing, so you see the exact table of contents and can fix the order or the wording before anything saves.

The write inserts the table of contents and the heading anchors and leaves your heading text and body copy alone. It never changes whether the post is published, and the agent puts the original body in the chat first, so pulling the table of contents back out later is easy. If you change your mind later, the Changes tab in wp-admin can revert the edit as long as nobody has edited the post since. The update ability stays off until you enable it, every call is checked against the capability of the user you bound the agent to, and the edit lands in the Activity Log with the post it touched.

Already connected? Skip the paste. Ask your agent for the “add a table of contents to a long post” recipe, or just point it at a long post, and it runs the same read-approve-insert flow on your own site.

How it works

  1. Read the post you name as raw block markup and pull its headings in order.
  2. Build an anchored table of contents from those headings and show it to you.
  3. Wait for approval before touching the post.
  4. Paste the current body into the chat so you have a copy, then insert the table of contents near the top, linking each entry to its section.
  5. Return what it changed.

Questions

Do the links jump to the right sections?
Yes. The agent anchors each heading and points each table-of-contents entry at its own section, so the links scroll to the matching part of the post.
Will it rewrite my headings?
No. It reads your headings as they are and builds the list from them. It adds the table of contents and the anchors, and leaves your heading text and body copy alone.