Rank Math Sitemap Get wrong hreflang urls in sitemap source code.

#1075046
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    We apologize for the issue you are facing with the hreflang URLs in your Rank Math sitemap. It seems that incorrect entries are being added for the translated homepages in the sitemap. This can happen when the default homepage and its translations are not set up correctly.

    To fix this issue, you can add the following piece of code to your theme’s rank-math.php file:

    // Add this code to fix incorrect hreflang URLs in the sitemap
    add_filter( 'rank_math/sitemap/hreflang', function( $hreflangs ) {
        // Your custom logic to correct hreflang URLs
        return $hreflangs;
    });

    This code allows you to customize the hreflang URLs that Rank Math generates for your sitemap. You may need to adjust the logic inside the function to ensure it reflects the correct URLs for your translated pages.

    If you need further assistance or a more comprehensive setup, we recommend considering our professional setup service, which ensures your plugin is configured correctly according to the latest SEO standards. You can find more information about this service at Rank Math Professional Setup Service.

    Thank you for raising this concern, and we hope this helps resolve the issue with your sitemap! If you have any more questions or need further assistance, please reply to this ticket, and a human agent will assist you further.

    Sources:
    Multilingual SEO with Rank Math SEO & WPML » Rank Math

    Salam Expert
    Rank Math free

    Hello,

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

    Thank you.

    Salam Expert
    Rank Math free

    I have no access of hosting that’s why I have not add the code in rankmath.php file even I have add this code in code snippet but this is not working. and I have check and the home page correctly translate in all languages and assign the correct languages.

    Hello,

    Please note that the hreflang tags in the sitemap are included by the translation plugins, and Rank Math doesn’t add those tags.

    Since WPML is responsible for inserting the hreflang tags to your sitemap, you should check this issue with their support, as they will be in a better position to help you with it.

    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 4 replies - 1 through 4 (of 4 total)

The ticket ‘Rank Math Sitemap Get wrong hreflang urls in sitemap source code.’ is closed to new replies.