Duplicate entry /blog in sitemap

#54993
  • Resolved Cheefoo
    Rank Math pro

    Though Thrive themes builder is now compatible with Rankmath, I’m not sure if this bug is resolved.
    When you use the sitemap, it shows the following:

    Page sitemap: abc.com/blog
    Post sitemap: abc.com/blog

    This is not normal. It should only show once at post sitemap.

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

    Thank you for contacting Rank math today.

    This can happen if you are using it as a dedicated blog page and you have the same structure in permalinks as well.

    Having the same URL in two places will not have ANY effect on your crawling. If you wish to remove a URL, you can use this filter: https://rankmath.com/kb/filters-hooks-api-developer/#change-remove-post-url

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    So should i use this below code to remove /blog in sitemap page or post ?

    Where should i put the code? In theme custom CSS?

    add_filter( ‘rank_math/sitemap/xml_post_url’, function( $url, $post){
    return $url;
    }, 10, 2 );

    Alberto
    Rank Math business

    Hello,

    The code my colleague gave you was just the base code you should use, but you would need to customize it to fit your needs. I did it for you and you just need to add it at the end of the functions.php file in your current theme:

    add_filter( ‘rank_math/sitemap/xml_post_url’, function( $url, $post){
    if(strpos($url, '/blog')!==false){
    return false;
    }
    return $url;
    }, 10, 2 );

    Looking forward to help you.

    Thanks pal, appreciate it.

    By the way, is this a compatibility issue with the theme and rankmath?
    Maybe I can ask the theme to create a fix rather than placing the code in the function.php? It will be overwritten by the theme new updates, as the theme does not allow child theme.

    Hello,

    Thank you for contacting Rank Math today.

    You can get in touch with them and forward them the code we have provided. Let us know how it goes.

    Looking forward to helping you. Thank 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 5 replies - 1 through 5 (of 5 total)

The ticket ‘Duplicate entry /blog in sitemap’ is closed to new replies.