Dynamic Gutenberg block | “Refreshing” the page score with dynamic content ?

#854785
  • Resolved Antonio_deligraph
    Rank Math free

    Good afternoon,

    I’m a developer currently using Rank Math for a client.

    In our project, we are using Gutenberg dynamic blocks to inject content from a selected custom post type. The final documentation page is composed of several dynamic blocks, each one injecting content from different post types.

    My question is: is there a JavaScript/PHP function or filter that I can use to pass the dynamic content and update the page SEO score/calculation in the sidebar? Currently, the Rank Math score in the sidebar does not account for this dynamic content.

    Abstractly, the front-end code in php looks something like this:

    // injects some content related to post-id content
    // injects some content related to post-id content

    … and so on

    In the editor, the block content preview is fetched this way:

    const currentRelatedPost = useSelect((select) =>
    select(“core”).getEntityRecord(“postType”, “questions”, relatedPostId),
    );
    // and then
    <RawHTML>{currentRelatedPost.content.rendered}</RawHTML>

    Thank you for your assistance.

    Best regards, Antoine

Viewing 1 replies (of 1 total)
  • Hello,

    We apologize for the issue you are facing with updating the Rank Math score in the sidebar when using dynamic Gutenberg blocks. Thank you for raising this concern.

    To refresh the Rank Math analysis when dynamic content is injected, you can use the following JavaScript function:

    rankMathEditor.refresh('content');

    This function will reload the content tests and should help in recalculating the SEO score based on the dynamic content you are injecting into your blocks.

    You can call this function after your dynamic content is loaded to ensure that Rank Math analyzes the updated content. If you need to refresh the title tests as well, you can use:

    rankMathEditor.refresh('title');

    For more details on how to implement this, you can refer to our documentation on the Content Analysis API.

    If you have further questions or need additional assistance, please feel free to reply to this ticket, and a human agent from the Rank Math Support team will assist you further.

    Best regards!

    Sources:
    Rank Math Content Analysis API for Theme & Plugin Developers

    This is an automated reply from Rank Math Support Bot. If you need further assistance, please reply to this topic and a human support agent will reply to you shortly.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Dynamic Gutenberg block | “Refreshing” the page score with dynamic content ?’ is closed to new replies.