Blog is being referenced twice in the sitemap

#673971
  • Resolved Anonymous
    Rank Math free

    Hey there,

    We have a Beaver Builder site with RankMath installed. The blog (post ID=28) is being referenced in the sitemap twice.

    Once in the Pages sitemap and once in the Posts sitemap.

    The Sitemap Index URL has been included in the sensitive data field of this form.

    I can’t figure out how to remove the one indexed in the posts sitemap.

    Any ideas?

    We have RankMath Pro installed on this site, but I am not the account holder.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Hello,

    We apologize for the inconvenience you are facing with the duplicate reference of the blog in the sitemap. This issue can occur due to the configuration settings in Rank Math.

    To resolve this, you can check the Sitemap settings in Rank Math. Under the Sitemap tab, you can exclude certain post IDs and term IDs that you want to exclude in Exclude Posts and Exclude Terms, respectively.

    If the URL that has been excluded from your sitemap is an author page, then be sure to check the Authors sitemap settings. In addition to excluding users from the sitemap based on user IDs, there is an option to exclude users based on their user roles.

    If you have access to the Rank Math settings, you can navigate to the Sitemap settings and make the necessary exclusions. If you don’t have access, please reach out to the account holder who has installed Rank Math Pro on your site to make these changes.

    If you need further assistance, please feel free to assign this ticket to a human agent using the available buttons, and we will be happy to help you further.

    Thank you for bringing this concern to our attention.

    Sources:
    Why Isn’t My URL Included in the Sitemap? » Rank Math
    Advanced Tab in Rank Math SEO’s Meta Box
    Rank Math Sitemap Issues and Their Fixes » Rank Math
    How to Setup Rank Math SEO Plugin Properly

    Anonymous
    Rank Math free

    This response is not relevent. The blog page ID is being referenced in the pages and post sitemaps. If I block the post ID, it will remove it from both.

    Can you connect me with a human?

    Hello,

    Thank you for your query, and we are so sorry about the trouble this must have caused.

    After excluding the blog page using it’s ID in the settings please add the code given below to your site to add it back once only to your page sitemap xml.

    add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ) {
    	
    	// Check if the post type is 'page'
    	if ( 'page' === $post_type ) {
    		
    		// Return the blog URL to replace the missing blog url in the page sitemap
    		return home_url( '/blog/' );
    }
    	
    		// Return the original URL for other post types
    		return $archive_url;
    }, 10, 2 );

    Here’s how you can add filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    We hope that helps, and please don’t hesitate to get in touch if you have any other questions.

    Thank you.

    Anonymous
    Rank Math free

    Hey there.

    I tried this with both Code Snippets and WPCodebox, but neither worked.

    1. Navigated to Rank Math SEO > Sitemap Settings > General
    2. Entered “28” (post ID 28) into the Excluded Posts
    3. Installed Code Snippets
    4. Inserted provided code
    5. Activated the code

    The sitemap didn’t display the blog on either the post or pages sitemaps. I’ve since removed post ID 28 from the excluded list.

    Any other ideas?

    Hello,

    Thank you for your patience.

    Could you please try this filter instead to disable the blog on page sitemap only?

    add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ){
    if ($post_type == 'page'){ // match to the actual post type name
    	$archive_url = false;
    }
    	return $archive_url;
    }, 10, 2 );

    Let us know how this goes.

    Anonymous
    Rank Math free

    It’s not duplicate content. It’s one post ID. If I exclude the post ID, it excludes it from both the page and post sitemaps.

    Anonymous
    Rank Math free

    Unfortunately, it still didn’t work. If I activate the snippet, nothing changes.

    If I activate the snippet and exclude the post ID (28), it is still excluded on both.

    Here’s the code that I activated in the snippets plugin:

    add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ){
    if ($post_type == 'post'){ // match to the actual post type name
    	$archive_url = false;
    }
    	return $archive_url;
    }, 10, 2 );

    I’ve tried both “post” and “page” as the post type name.

    Hello,

    After applying the filter, try flushing the sitemap cache by following these steps:
    https://i.rankmath.com/pipRDp

    If the issue still persists, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.

    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Anonymous
    Rank Math free

    Hey RankMath team,

    I had another look but was unable to resolve the issue. If it’s still possible, we would like to take your offer for some assistance. I’ve updated the sensitive information with the required login credentials for you.

    Hello,

    We would like to login into your admin dashboard but it seems the login username/password you shared is not correct. Can you please verify this from your end?

    Looking forward to helping you.

    Anonymous
    Rank Math free

    Hey Jeremy,

    We had SSO turned on. You should be able to access the login page now using the provided credentials. My apologies for the confusion.

    Hello,

    Thank you for your patience.

    Upon checking your site, it seems that you’re using outdated version of the Rank Math plugins.

    Could you please confirm if it’s intentional or if there’s a reason why you’re still using the old version?

    If not, then we recommend installing the latest version since the Rank Math PRO plugin wouldn’t work with that version and to ensure that it is not causing the filter to work.

    Let us know how this goes.

    Anonymous
    Rank Math free

    Hey there,

    No, it was not intentional. I’ve updated the plugin. You should be good there now.

    Hello,

    Thank you for your patience.

    We have already released the fix for this issue with our latest version:
    https://rankmath.com/changelog/free/

    Also, the blog page is no longer appearing in your page sitemap upon checking.

    Looking forward to helping you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘Blog is being referenced twice in the sitemap’ is closed to new replies.