Yoast / yoast-acf-analysis

WordPress plugin that adds the content of all ACF fields to the Yoast SEO score analysis.
https://wordpress.org/plugins/acf-content-analysis-for-yoast-seo/
GNU General Public License v3.0
62 stars 20 forks source link

Contents in nested/inner blocks not recognized/collected #300

Open highbelt opened 2 years ago

highbelt commented 2 years ago

Please give us a description of what happened.

Seems like word count is not working for „nested“ inner blocks (https://www.advancedcustomfields.com/resources/acf_register_block_type/, „Adding inner blocks“) as the current implementation excludes the parent/embedding blocks.

e.g. https://github.com/Yoast/yoast-acf-analysis/blob/48b01c7181d5c838e5189a8d68b9692c403dd0e2/js/yoast-acf-analysis.js#L245 and https://github.com/Yoast/yoast-acf-analysis/blob/48b01c7181d5c838e5189a8d68b9692c403dd0e2/js/src/collect/collect-v5.js#L44

jQuery( '[data-block="${block.clientId}"] .acf-block-preview' ).length in this case returns > 1 and the block will be ignored.

Changing the condition to .length >= 1 fixed it for me - not knowing, if this breaks somewhere else. 🤷 Is there a reason why it is set to === 1?

Please describe what you expected to happen and why.

All contents should be recognized, even if nested in another block

How can we reproduce this behavior?

  1. Add a nested block content/structure in your page/post
  2. Inner blocks will be ignored by the SEO analysis

Technical info