Home Forums WoodMart – Premium Template Yoast Sitemap – Woodmart Images not showing

Tagged: ,

This topic contains 2 replies, has 2 voices, and was last updated by Elise Noromit Elise Noromit 1 month, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #197970

    301.digital
    Customer

    Not all the images on a page/product are showing on the sitemap of Yoast.
    For example, the images of a carousel are not showing (woodmart-gallery-item).

    Is there a workaround so that I can add these images to the sitemap?

    Private Content Hidden
    #197973

    301.digital
    Customer

    I found this url:
    https://gist.github.com/chriswiggins/0756f61f745b9b08cc13e86573768f05

    And the following function from the Divi theme:
    /* Add Divi images to Yoast sitemap, since Yoast doesn’t read Divi’s Page
    * Builder code (https://github.com/Yoast/wordpress-seo/issues/4808) */

    function dm_filter_wpseo_sitemap_urlimages($images, $post_id)
    {
    $post = get_post($post_id);

    if (is_object($post)) {
    $content = $post->post_content;

    # Parse Divi Image modules
    preg_match_all(‘/\[et_pb_image [^]]*]/’, $content, $divi_images);

    foreach ($divi_images[0] as $divi_image)
    {
    # Add the image to the sitemap
    preg_match(‘/src=”([^”]*)”/’, $divi_image, $src);
    preg_match(‘/title_text=”([^”]*)”/’, $divi_image, $title);
    preg_match(‘/alt=”([^”]*)”/’, $divi_image, $alt);
    $images[] = array(‘src’ => $src[1], ‘title’ => $title[1], ‘alt’ => $alt[1]);
    }

    # Parse Divi Blurb modules
    preg_match_all(‘/\[et_pb_blurb [^]]*]/’, $content, $divi_blurbs);

    foreach ($divi_blurbs[0] as $divi_blurb)
    {
    if (preg_match(‘/image=”([^”]*)”/’, $divi_blurb, $image))
    {
    # If the blurb has an image, add it to the sitemap
    preg_match(‘/title=”([^”]*)”/’, $divi_blurb, $title);
    preg_match(‘/alt=”([^”]*)”/’, $divi_blurb, $alt);
    $images[] = array(‘src’ => $image[1], ‘title’ => $title[1], ‘alt’ => $alt[1]);
    }
    }
    }

    return $images;
    }
    add_filter(‘wpseo_sitemap_urlimages’, ‘dm_filter_wpseo_sitemap_urlimages’, 10, 2);

    #198021

    Hello,

    Please test this functionality on any default theme, to detect if our theme causes the problem. If you see the same on the other theme, please contact the plugin support.

    Best Regards

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.