wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Broken analisys when reusable blocks are placed as inner blocks

Open CarloCannas opened this issue 3 years ago • 1 comments

  • [x] I've read and understood the contribution guidelines.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

When a post includes a reusable block inside another block YoastReusableBlocksPlugin handles it incorrectly: instead of retrieving the reusable block content and inserting it at that point, it inserts the whole post content.

https://github.com/Yoast/wordpress-seo/blob/18.7/packages/js/src/analysis/plugins/reusable-blocks-plugin.js#L95

It appears this broken "replace with the whole post content" behavior was introduced in commit https://github.com/Yoast/wordpress-seo/commit/1a4d5a5e82af635de56c594a61cc6eb381ad2f79#diff-9371b3a1da616205ce15cd3f1016371d8b45d12d72704c1ab7abc2904b4b20b8R89 only a few months ago (version 18.5).

Please describe what you expected to happen and why.

YoastReusableBlocksPlugin should handle correctly reusable blocks placed inside other blocks.

How can we reproduce this behavior?

  1. Create a new post
  2. Add some content (paragraphs, titles)
  3. Add a Columns block
  4. Add a reusable block inside a column
  5. The analysis will report double the word count, double the keyphrase match count

Technical info

  • If relevant, which editor is affected (or editors):
  • [ ] Classic Editor
  • [x] Gutenberg
  • [ ] Classic Editor plugin
  • Which browser is affected (or browsers): not relevant

Used versions

  • WordPress version: 5.9.3
  • Yoast SEO version: 18.7

CarloCannas avatar May 03 '22 10:05 CarloCannas

Hi, I also have the same problem. Is there any news about it?

alessandrolioce avatar Aug 29 '22 15:08 alessandrolioce

Please inform the customer of conversation # 985055 when this conversation has been closed.

suascat avatar Feb 03 '23 06:02 suascat

Still reproducible in Yoast SEO 20.4.

https://user-images.githubusercontent.com/9658774/230357398-b978db14-8911-4020-922d-61cee17332cd.mp4

Code in WP editor

<!-- wp:paragraph -->
<p>This is a paragraph.</p>
<!-- /wp:paragraph -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:block {"ref":138} /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

monbauza avatar Apr 06 '23 10:04 monbauza

Please inform the customer of conversation # 999218 when this conversation has been closed.

monbauza avatar Apr 06 '23 10:04 monbauza

Please inform the customer of conversation # 1011484 when this conversation has been closed.

josevarghese avatar Apr 24 '23 06:04 josevarghese