Images missing in sitemaps if using Reusable Blocks

#591968
  • Resolved Anonymous
    Rank Math free

    Hi,

    We are evaluating Rankmath since we are thinking to switch from Yoast SEO. When comparing sitemaps generated by both SEO tools, we noticed, that Rankmath seems to miss some images in the sitemap, which appears in the Yoast SEO sitemap. Further analysis showed, that those images where from Reusable Blocks, which we use in some cases.

    In other cases Rankmath seems to handle those Reusable Blocks correctly (e.g. when calculating word count and other SEO metrics).

    Yoast, too, handles those images from reusable blocks correctly.

    How can we fix this problem?

    Best regards,

    Jörg

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hello,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    I tested this out in a local setup and it seems the image from a reusable block has been registered on the sitemap.

    In the sitemap settings, please make sure that you have enabled the “Images in Sitemap” option:

    Rank Math support

    If that option is already enabled, Please follow the steps below:

    1. Flush the Sitemap cache by following this video screencast:
    https://i.rankmath.com/pipRDp

    2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
    https://rankmath.com/kb/exclude-sitemaps-from-caching/

    Let us know how that goes. Looking forward to helping you.

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Anonymous
    Rank Math free

    Hi,

    Whatever the reason, the sitemap generated by Rankmath does contain significantly less images than the one generated by Yoast. I added a link to the sitemaps in the sensitive data section of the ticket. There you will find a zip file, which contains two page-sitemaps.xml. One was generated with Rankmath, one with Yoast. So I just disabled Rankmath and enabled Yoast and downloaded the same file again. See for yourself.

    Since this is on our staging system, I can provide you with access if you need to do any debugging. Please let me know.

    Best regards,

    Jörg

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Anonymous
    Rank Math free

    Hi Jaideep,

    Thanx for looking into this!

    Please send me an E-Mail address to set up WP Login with.

    Best regards,

    Jörg

    Hello,

    Thank you for your reply. We appreciate your cooperation.

    You can email the credentials and login details to s******@r***********. Please make sure to update us here so we are aware.

    We will wait for your email and get back to you as soon as possible.

    Best regards,

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    To check this further, our developers will need FTP access to your site. Please provide it so they can proceed further.

    Looking forward to helping you.

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    Thank you for sharing the FTP access. The UpSolution Core plugin on your site has added the code to include the images from the Reusable block in the Yoast sitemap. We’ll get in touch with them so they can add the compatibility code for Rank Math as well.

    For now, to fix the issue on your site I have added the following code to your theme’s functions.php file to include the images from the Reusable block in the Sitemap:

    
    add_filter( 'rank_math/sitemap/urlimages', function( $images, $post_id ){
    	if ( ! function_exists( 'us_get_recursive_parse_page_block' ) ) {
    			return $images;
    		}
    		$post = get_post( (int) $post_id );
    		us_get_recursive_parse_page_block(
    			$post, function( $post ) use ( &$images ) {
    			if ( preg_match_all( '/\[us_image\simage="(\d+)"/', $post->post_content, $matches ) ) {
    				foreach ( us_arr_path( $matches, '1', array() ) as $attachment_id ) {
    					$images[] = array(
    						'alt' => get_post_meta( $attachment_id, '_wp_attachment_image_alt', TRUE ),
    						'src' => wp_get_attachment_image_src( $attachment_id, 'full' )[0],
    						'title' => get_the_title( $attachment_id ),
    					);
    				}
    			}
    		}
    		);
    	return $images;
    }, 10, 2);
    

    The Sitemap is now showing all the images. Can you please confirm?

    I hope that helps.

    Anonymous
    Rank Math free

    Hi Pratik,

    Thanx! Looks very good 🙂

    Regarding the fix you did in function.php: Do we need to remove it once it is included in UpSolution Core plugin? Do we need to manually apply the fix again if we update the Theme?

    Best regards,

    Jörg

    Hello,

    Since the code is added to the themes’s functions.php file, the changes will be removed if the theme is updated.

    If the the UpSolution Core plugin updates and includes the fix for the issue then even if the added code is removed from the theme functions.php there will be no issues for you, in that case.

    However, if there is any other update without the fix, then in that case you will have to keep the code in the functions.php file.

    You can also use the code snippets plugin, to add the code to the functions.php file, as the code snippets plugins keeps the code in place even if the theme is updated.

    Using this plugin, you can add custom snippets to your website’s functions.php file) : https://rankmath.com/kb/wordpress-hooks-actions-filters/#code-snippets-plugin

    We hope that helps, and please don’t hesitate to get in touch if you have any other questions.

    Thank you.

    Anonymous
    Rank Math free

    Hi Alhan,

    Thanx for the prompt reply! How will I know when the fix is added to the theme code? Could you let me know?

    Best regards,

    Jörg

    Hello,

    The UpSolutions developer team can either update the UpSolution Core plugin , the Zephyr – Material Design Theme or both to fix this issue.

    It totally depends on what they wish to proceed with depending upon the situation.

    You can contact the support team of the Zephyr Theme team or UpSolution Core plugin team for more information about this.

    You can also keep an eye on their changelogs :

    UpSolution Core
    https://help.us-themes.com/zephyr/plugins/us-core/#changelog

    Zephyr – Material Design Theme
    https://help.us-themes.com/zephyr/changelog/version8/

    We hope that helps, and please don’t hesitate to get in touch if you have any other questions.

    Thank you.

    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 14 replies - 1 through 14 (of 14 total)

The ticket ‘Images missing in sitemaps if using Reusable Blocks’ is closed to new replies.