images in sitemap

#700096
  • Resolved Lucia
    Rank Math free

    Hi,
    when I generate a page sitemap, all images in each page are supposed to be included. In sitemap I see page url and then a number of images which will be included (6). Is it possible to know which images are these ones?
    I’m asking because I have more images and don’t know which ones, and whoy, are going to be added.
    Thanks,
    Lucía

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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:
    image custom fields in pages sitemap

    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

    Lucia
    Rank Math free

    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

    Lucia
    Rank Math free

    Hello,

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

    Thank you.

    Lucia
    Rank Math free

    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.

    Lucia
    Rank Math free

    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.

    Lucia
    Rank Math free

    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.

Viewing 10 replies - 1 through 10 (of 10 total)

The ticket ‘images in sitemap’ is closed to new replies.