“This block contains unexpected or invalid content” for internal page links
-
When working with HTML on large pages, I’m in the habit of creating a “Table of Contents” at the top of the page with internal links to each section. This is very convenient for readers, and also eliminates the need for me to write a separate page for each section that are all on the same general topic (and there can be many).
Here’s a simple example…
The table of contents:
<a href="#S1">Section 1</a><br> <a href="#S2">Section 2</a><br> <a href="#S3">Section 3</a><br>
etc…
Further down the page directly above the <h3> title of each section, within “<!– wp:heading {“level”:3} →” tags (in this particular case):
<a name="S1"></a> <a name="S2"></a> <a name="S3"></a>
I just converted one of these pages to blocks, and the Gutenberg editor had no complaints.
But, it stripped out all of this code, and naturally because of that the TOC no longer worked. So, I added it back in manually using the “code” editor, and everything was back to normal with no errors indicated by Gutenberg in the “visual” editor, even after clicking “Update”.
The next time I went in to edit the page, it contained blocks flagging all of the places I did this (see topic title).
Despite the block errors displayed, after changing a few things to force the “Update” button to become active, all was still well with the TOC functioning. However, it’s very annoying to see these errors every time I update the page, especially since it’s perfectly valid HTML.
Is there another way of accomplishing this in Gutenberg that I should be using instead? I really don’t see the point of having a code editor option in the first place if it won’t properly accept valid HTML.
The page I need help with: [log in to see the link]
- The topic ‘“This block contains unexpected or invalid content” for internal page links’ is closed to new replies.