• Resolved Constantin Flux

    (@constantflux)


    Hey,

    I just purchased yoast premium and noticed yoast only includes one image on most of my posts and pages in the sitemap.
    https://constantinflux.com/sitemap_index.xml

    I’d like to submit a sitemap to google that correctly shows all my images to avoid getting strikes for thin pages. I’m using W3 Cache which seems to be a factor in most of the other users problems with no or only one image in their sitemap per post or page. Also I’m using cloudflare as cdn.
    The theme I use is Kalium which comes bundles with wp bakery, which I use.
    All of these are updated to the latest versions.

    One of the pages shows more than 1 image in the sitemap. There are actually around 10 images on this page, but the sitemap only shows 5 though:
    https://constantinflux.com/produktfotografie-fotograf-niederrhein-%f0%9f%91%bb-who-you-gonna-call/

    What can I do to create a correct sitemap with yoast?
    Can I refresh the sitemap somehow?

    Thank you for your help.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support devnihil

    (@devnihil)

    @constantflux Some plugins, themes and page builder modules may not show additional images in the sitemap, if your products have additional images you want included you may need to add them via a filter: wpseo_sitemap_urlimages.

    We have additional information on including images in the site located at the following link: https://yoast.com/help/images-in-the-xml-sitemap/

    Also, unfortunately, per the forum guidelines, we cannot answer questions about our premium products. For questions about these products, please contact our support team directly.

    Thread Starter Constantin Flux

    (@constantflux)

    So people seem to have had an issue with RankMath and WP Bakery as well and they solved it together with RankMath:
    https://notasusual.co/rank-math-wpbakery-sitemap-fix/

    Specifically with this code:

    add_filter( 'rank_math/sitemap/urlimages', function( $images, $id ){
        if ( empty( $images ) ) {
            $post = get_post( $id );
            if ( $post && strpos( $post->post_content, '[vc_row' ) !== false ) {
                preg_match_all( '/(?:image|images|ids|include)\=\"([^\"]+)\"/', $post->post_content, $matches );
                foreach ( $matches[1] as $m ) {
                    $ids = explode( ',', $m );
                    foreach ( $ids as $id ) {
                        if ( (int) $id ) {
                            $images[] = array(
                                'src' => wp_get_attachment_url( $id ),
                                'title' => get_the_title( $id ),
                            );
                        }
                    }
                }
            }
        }
    
        return $images;
    }, 10, 2 );

    If you look at this, can you see if this is a fix that would work with yoast as well and if so, how could I set this up?
    Is the what you mean by “add them via a filter”? The solution for the problem with WP Bakery and RankMath was solved by attaching the code at the end of the functions.php. No need to manually include images from each post/page/potfolio item that doesn’t work.

    Plugin Support Suwash

    (@suascat_wp)

    @constantflux

    We understand you found a possible workaround to fix the issue in reference to RankMath. While we need to investigate further this issue, since you’re a Yoast SEO Premium user, we would request that you contact support[at]yoast.com helpdesk directly. We could then troubleshoot the issue and resolve it.

    Plugin Support devnihil

    (@devnihil)

    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Only one image in sitemap in every post and page’ is closed to new replies.