Open Rvervuurt opened 4 months ago
Hi @Rvervuurt
Thanks for using the Yoast SEO plugin and also for creating the issue. Our Table of Contents block uses the HTML Anchor feature, which is available on the Yoast SEO Premium, to navigate to the heading from the ToC. So when I tried to copy-paste the document from Google Docs with headings, I noticed that the HTML Anchor get generated correctly on the block editor for all the headings automatically.
If you are not using Yoast SEO Premium, we recommend you purchase one for your website. and you can test this on the demo site having Yoast SEO Premium at here
Closing this issue as we are providing this functionality on the Yoast SEO Premium plugin.
I am using Yoast SEO premium. :)
Based on your screenshot, you pasted the piece of text once. Can you try pasting it twice, and see if the 2nd one also gets an HTML anchor? I added a note, to clarify that the first paste gets the correct anchor, but the 2nd doesn't, but I guess it wasn't clear enough.
Hi @Rvervuurt
Thanks for using Yoast SEO Premium on your website.
First, please note that most posts won't have the same heading mentioned twice, as this will confuse users, and it's a different use case if you are using the same heading for a post twice. So, making some changes to the second heading that you have copied again will help our plugin generate the HTML anchor automatically.
Also, instead of copying the same heading words and paragraph again from the Google Document, try to copy the same heading and paragraph that you have added to the block post before, it will help our plugin to increment the HTML anchor by adding -0 -1 -2 to the end of the HTML Anchor as our plugin can detect the previous HTML anchor for the same heading before. See the screencast for your reference: https://www.loom.com/share/05a292405d3b44a48efbe6ee09d8b7e5
Thanks
Hi @josevarghese, thanks for the quick reply!
I see that I'm working on an edge case here :) Please see this recording, where I do the following:
I have updated the document, so you can copy/paste the exact same content as I do.
Hi @Rvervuurt
Thanks for the reply. I forgot to update you after testing it. I can replicate the issue you have pointed out by copying and pasting the headings one by one. I also created an internal bug for the team to take a closer look.
As a workaround, I recommend copying and pasting the whole text from the Google doc in a single step instead of copying it seperately. This will help our plugin generate the anchor links without any issues.
Amazing, thanks for updating and reopening!
I also found out that adding a single character (and removing it immediately) to a title without anchor also generates it, so if we can't copy the whole text at once (there are situations where we can't, which is why we found this bug), we'll fall back to that.
Good luck with trying to fix this!
Please give us a description of what happened
Whenever my colleagues copy content into a page or custom post type from Google Docs, that includes a headline and some text, Yoast doesn't generate an anchor for the headline.
As soon as I add a letter to the headline, it generate an anchor tag, but we of course want that anchor tag to be generated when pasting the whole piece!
To Reproduce
Step-by-step reproduction instructions
Note: as seen in the video below, the headline in the first paste actually generates an anchor tag, but every headline after that doesn't.
Expected results
Actual results
Screenshots, screen recording, code snippet
https://github.com/Yoast/wordpress-seo/assets/1439765/588b771b-e149-4420-9012-30ae522b145f
Technical info
If relevant, which editor is affected (or editors):
[ ] Block Editor
[x] Gutenberg Editor
[ ] Elementor Editor
[ ] Classic Editor
[ ] Other:
Which browser is affected (or browsers):
[x] Chrome
[x] Firefox
[ ] Safari
[ ] Other:
Used versions