Hello,
I’m sorry for the inconvenience you’re experiencing. The Rank Math plugin allows you to include custom fields in your pages with image URLs. If you wish to include specific images in the sitemap, you can enter the custom field names in the “Image Custom Fields” section of the Pages tab in the Rank Math settings.
Here’s a screenshot of where you can add the custom field names for images in the Pages tab:
By adding the custom field names, Rank Math will understand them better and include those specific images in your sitemap.
If you have any further questions or need assistance with this, please feel free to ask.
Best regards.
Sources:
How to Configure Sitemaps in Rank Math – Best Settings and Tips
What Are the SEO Benefits of Sitemaps? » Rank Math
How to Name Images for SEO » Rank Math
How to Setup Rank Math SEO Plugin Properly
I’ve already talked to your bot but couldn’t solve
Hello,
Thanks for contacting us, and sorry for any inconvenience that might have been caused due to that.
Can you please share the sitemap URL with us so that we can investigate the issue further for you?
Looking forward to helping you.
Thank you
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
I’ve attached a sitemap url where 6 images are going to be added. I’de like to know which ones, and why.
Thanks
Hello,
You may need to inspect the source code of the page sitemap to know the images included. Please visit the link I’ve added in the sensitive data section where you can see the image URLs.
In summary, the images there will show if they are added to the content directly. The sliders, background, and gallery images are not included.
Hope that helps.
Thank you.
Really appreciate ypur tip to fins out which images will be added. Actually, non of theme is indexed…
Can you please help in order to include images in galleries or builder items? Maybe manually?
Thanks,
Lucía
Hello,
Thank you for your patience.
If the images are being added as background images instead of actual images inside the default img
tag, there’s nothing we can do from our side to detect those properly and include them in the sitemap.
An alternative solution would be to customize the code snippet below. You would need to add a check for a gallery and automatically add the gallery images to the sitemap if a gallery exists:
/**
* Filter images to be included for the post in XML sitemap.
*
* @param array $images Array of image items.
* @param int $post_id ID of the post.
*/
add_filter( 'rank_math/sitemap/urlimages', function( $images, $post_id ){
return $images;
}, 10, 2);
And here’s a guide to adding the code to the website:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Looking forward to helping you.
Sorry for delay.
Are not background images, but gallery ones. How am I supposed to edit your snippet? Shall I replace $post_id for real id, or what shall I do?
Thanks
Hello,
Further optimization of the code falls out of the scope of our support. You will have to use the real page ID and then loop through the images added using the gallery to include them in the sitemap.
You can hire a profession developer or ask for help from the support of the gallery plugin to modify the filter.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
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.