Turn plain links into on-page jump anchors

ContentIntermediate~15 minUpdated

Before you start

A connected site with content reads on and the content write abilities enabled. Works best on a long post that already has real section headings. Replace in post cannot add an id attribute to a heading, so the agent sends the updated body through Update post, which means the whole body goes in one call. It first checks that the post has an earlier revision, because a post with none has nothing to roll back to.

A guide that runs past a couple of thousand words needs a way to jump around, but adding anchor ids to every heading and hand-building the “in this article” list is fiddly, easy to get wrong, and the sort of thing you put off. So the long post stays a wall with no shortcuts, and readers bounce before they reach the section they came for.

This hands the mechanical part to the agent and keeps you as the one who says go.

The prompt
I want to add jump links to [this long post: https://example.com/my-guide/].
Read the post first and change nothing yet. List its revisions too, and tell me
whether it has any revision older than the current body. If it has none, paste
the full original body into your reply before any write, so I have a copy.
Find the section headings, and
for each one work out a clean anchor id from the heading text. Then hand me
back a plan: the list of headings you found, the anchor id you would give
each, and the "jump to section" list you would add near the top that links
down to them.
Wait for my yes. Only after I approve, add the anchor ids to the headings
and insert the jump list, editing the post body and nothing else. You will
need to send the updated body through the post update, because the
find-and-replace tool will not add an id to a heading. Leave the status alone
so it does not republish. When you are done, give me the before-and-after for every
heading you touched.

Why this is safe to run

The whole first pass is a read. Pulling the post and mapping out the headings writes nothing, so you see the full plan, every heading and every id, before a single character is saved.

The write half only edits the post body. It never changes the status, so it cannot publish a draft or take a live post down. The agent checks first whether the post has an earlier revision, and the edit is recorded in the Changes tab, which can revert it provided nobody has edited the post after it. On top of that the content write ability is off until you switch it on, each call is checked against the capability of the user you bound the agent to, and every write shows up in the Activity Log with the post it changed.

Already connected? You do not have to paste this at all. Ask your agent for the “turn plain links into on-page jump anchors” recipe, or just describe the job, and it runs the same read-plan-approve flow on your own site.

How it works

  1. Read the post, list its revisions, and find its section headings, changing nothing.
  2. Work out a clean anchor id for each heading from its text.
  3. Show you the heading list, the proposed ids, and the jump list, and wait for your approval.
  4. Add the anchor ids to the headings and insert the jump list through Update post, editing the body only.
  5. Return a before-and-after for every heading it touched.

Questions

Will this republish the post?
No. It edits the body and leaves the status where it was, so a published post stays published and a draft stays a draft. Nothing goes live because of this.
Can I undo it if the anchors are wrong?
Yes. The Changes tab in wp-admin can revert the edit as long as the post hasn't been edited since. If the post already has an earlier revision you can also roll back from the editor. A post that has never been updated twice has none, so the agent first puts the original body in the chat for you to keep, and tells you when that is the case.