• Resolved shaunbowen

    (@shaunbowen)


    Hi there, for some reason the sitemap generated by The SEO Framework on one of my sites is empty.

    If I refresh the cache it says “Sitemap is locked for XXX seconds. Please try again later”.

    If I wait for XXX seconds, it then just loads the empty sitemap again.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter shaunbowen

    (@shaunbowen)

    I have figured out the culprit.

    I have a default script added to my functions.php to prevent certain pages from being added to the sitemap:

    add_filter(
    'the_seo_framework_sitemap_exclude_ids',
    function( $ids ) {

    $lp_parent_ids = get_posts( [
    'post_type' => 'landing_page',
    'fields' => 'ids',
    'post_parent' => 0,
    ] );
    //$my_exclude_ids = get_posts( [
    // 'post_type' => 'post',
    // 'fields' => 'ids',
    // 'category' => 9
    //] );
    return array_merge( $ids, $lp_parent_ids, $my_exclude_ids );
    }
    );

    However, the return was throwing an error when $my_exclude_ids is empty (as I commented out the code above it).

    I will mark this as resolved.

    Plugin Author Sybre Waaijer

    (@cybr)

    I’m glad you found the cause!

    Some backstory: the sitemap sets a lock when it’s building a cached copy. This prevents it from becoming a denial-of-service attack vector. The lock is released once the sitemap is built, but it cannot be released if the process crashes. The lock is automatically released after 180 seconds or PHP’s max execution time (whichever is smaller).

    In any case, if you don’t want the landing_page post type to appear in the sitemap, don’t you also want it to be unindexable? It might then be easier to apply “noindex” to the post type; this will also remove the posts from the sitemap.

    Thread Starter shaunbowen

    (@shaunbowen)

    Hi @cybr thanks for the explanation.

    Regarding the Landing Pages – I generally only want the top level ones hidden from the sitemap, but the children to still be visible, hence the code.

    I actually manually mark each top-level Landing Page as noindex too.

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

You must be logged in to reply to this topic.