• Resolved entmediatech

    (@entmediatech)


    Hi,

    I’ve already opened an issue but I’m asking this again since I could not resolve it.

    I have now several blank XML sitemaps in my website since I used the tag “noindex” for most of my old content (old posts). The original published posts were around 28,000, in fact I had 28 posts sitemaps (1,000 posts each).

    Now I set around 26,000 posts to “noindex” and they are correctly removed from the sitemaps. However, I am unable to also remove the blank sitemaps.

    I tried to deactivate the sitemap feature in YoastSEO, clearing cache, and then regenerate the sitemaps by enabling again the feature, but that didn’t work.

    Do you have other solutions? Thank you

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • @entmediatech

    We understand that you’ve set around 26K poosts to “noindex” and they got removed from the sitemaps. Indeed, each chunk of listed sitemaps (like post-sitemap2.xml, ..-3.xml, ….-4.xml, …) should also be removed from the sitemap list. We see this is not happening in your case. To confirm, could you please let us know how you’ve set the meta to noindex for all those posts? Is it programmatically or via the Yoast SEO settings?

    Thread Starter entmediatech

    (@entmediatech)

    Hi Suwash,

    I’ve done this using YoastSEO settings, through the WP All Import plugin and YoastSEO extension.

    I updated all the old post via csv import.

    Plugin Support Michael Tiña

    (@mikes41720)

    Hi,

    We aren’t sure if this is being caused by how the posts were imported and exported using the WP All Import plugin, but we would expect that if you were to individually set a post to ‘not show in the search results’, that it would be removed from the sitemap and that corresponding post sitemap wouldn’t generate if it doesn’t have any valid URLs.

    Can you please try resetting our indexables in the database tables by following the steps below?
    1. Install & activate the Yoast Test Helper plugin
    2. Go to Tools > Yoast Test
    3. Locate the Yoast SEO section and click on the ‘Reset indexables tables & migrations’, ‘Reset Prominent words calculation’, and ‘Reset Internal link counter’ buttons. After each click, the page will reload to confirm that each reset was successful. Note: Resetting the optimization doesn’t undo any of the hard work you’ve put into the plugin as the SEO data is also stored in WordPress’ default tables. It’ll just reset the custom Yoast tables that contain the combined data pulled from those default tables.
    4. Go to SEO > Tools, and under SEO data, click the “Start SEO data optimization” button to allow Yoast to rescan your content.

    Could you check if that resolves the issue?

    Thread Starter entmediatech

    (@entmediatech)

    Hi Michael, thank you for the support.

    I’ve done all the steps that you outlined in your answer, but that didn’t work. If you take a look at the sitemap you will notice that nothing changed.

    Sorry to hear that you’re still having trouble. Since none of the mentioned steps worked for you, we recommend you please add the following code snippet to your currently active theme functions.php file to see whether this resolves the issue for you:

    add_filter( 'wpseo_sitemap_index_links', 'remove_empty_sitemaps', 10, 1);
    
    function remove_empty_sitemaps( $links ){
    	foreach ( $links as $sitemap => $value ){
    		if ( ! $value['lastmod'] ){
    			unset( $links[$sitemap]);
    		}
    	}
    	return $links;
    }
    

    Please note that might need to modify the code snippet based on your site. It is highly recommended that you take a full backup of your website before applying the relevant code snippet.

    The relevant code snippet and further discussion about the issue can be found here: https://github.com/Yoast/wordpress-seo/issues/16771

    We hope this helps!

    Thread Starter entmediatech

    (@entmediatech)

    Hi,

    Thank you for code. I added this snippet through the Code Snippet plugin for WordPress and activated it, then refreshed the Sitemaps, but I’m still seeing empty sitemaps in my index.

    Take a look: https://www.betitaliaweb.it/sitemap_index.xml

    Do you think it’s necessary to add it in the functions.php?

    Thanks

    @entmediatech Thanks for your reply and we’re sorry to hear that you are still experiencing the issue with the blank sitemaps after implementing the code snippet.

    Regarding your question, a snippet such as this does typically work when added via the Code Snippet plugin. However, if you are experiencing problems with it working in the expected manner, we would recommend also trying it by including it directly within your site’s functions.php file.

    We are going ahead and mark this topic as resolved due to inactivity. If you require any further assistance, feel free to create a new topic. Thank you!

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

The topic ‘Update XML Sitemaps’ is closed to new replies.