• Resolved lukelol

    (@lukelol)


    Since the latest update, I am now having empty sitemaps:

    <?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet type='text/xsl' href='https://example.com/wp-content/plugins/google-sitemap-generator/sitemap.xsl'?><!-- sitemap-generator-url='https://www.arnebrachhold.de' sitemap-generator-version='4.1.7' -->
    <!-- generated-on='November 29, 2022 9:40 pm' -->
    <urlset xmlns:xsi='https://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd' xmlns='https://www.sitemaps.org/schemas/sitemap/0.9'></urlset><!-- Request ID: 958512a8e6a04d22883531b5da0cf987; Queries for sitemap: 220; Total queries: 223; Seconds: $end_time; Memory for sitemap: 5.7734375MB; Total memory: 12MB -->

    The query ends up hitting the database and returning results, but nothing ends up in the sitemap.
    After downgrading back to 4.0.9, the sitemaps returned as expected.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @lukelol thanks for reaching out to us. Could you please provide us the sitemap URL as well as check what errors are getting dumped inside the error log file when you try the version 4.1.7?

    Thread Starter lukelol

    (@lukelol)

    I’ve been able to confirm the last working version is 4.1.5

    After some further digging, I think the issue lies in class-googlesitemapgeneratorstandardbuilder.php

    I suspect this line is used for some pagination feature?

    $posts = array_slice( $posts, ( $limit - $links_per_page) );

    I think the limit or links_per_page may not be properly set and thus the $posts array is empty after the array_slice operation.

    Commenting out this line (175) as well as adjusting line 94 (increasing the limit to 50000 in the case it is set to 0) fixed the issue for me, though I suppose this may cause links_per_page or limits to not be properly set.

    line 94: $limit = (( (int) $limits ) * $links_per_page)?:50000;

    Thanks for following up @saurabhdhariwal01 Hope you can get this resolved in the next release.

    • This reply was modified 1 year, 12 months ago by lukelol.

    Hi @lukelol I believe you are trying to use the older sub-sitemap URL? The reason is: with the new version, we have changed the URLs of all the sub sitemap links. Therefore every sub sitemap will have p1, p2 suffix added inside the file name. Therefore if you use unmodified 4.1.7 version and visit the index of the sitemap, you should see the new URLs of all the sub sitemaps and it should work as expected. However, you have made some adjustments, so you can either keep them as is or for the sake of clarity and debugging, you can try what I have conveyed (however if your site is already live then I would not recommend to make any experiments). Thanks!

    I’m quite impressed with your writing, and your article’s content has captured my attention. I look forward to more outstanding posts. monkey mart

    Thank for this information. superbetting

    I think the limit or links_per_page may not be properly set and thus the $posts array is empty after the array_slice operation.

    • This reply was modified 11 months, 2 weeks ago by evawillms.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘empty sitemap’ is closed to new replies.