Skip to content

Table of contents block – links don't work on initial page save #43595

@Greatdane

Description

@Greatdane

Description

If you add the Table of Contents block to a new page, when you publish the page, the links don't work properly and instead open a new page with a Page not found error. The URL is retaining an auto-draft in it. If you edit and Update the page, the links will then work properly. Alternatively, if you publish the page first, then add the Table of Contents block, they will work correctly.

Step-by-step reproduction instructions

Create a new page
Add content, with headings, and the Table of Content block
Publish the page
View the page
Try the TOC links
Return to the editor and make a change
Update the published page
View the page
The TOC links now work

Screenshots, screen recording, code snippet

Screen.Capture.on.2022-08-20.at.10-40-21.mp4

Environment info

WordPress version 6.0.1
Gutenberg 13.9.0

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions