Canonical URL not showing in sitemap

#432745
  • Resolved Julia
    Rank Math free

    Hello!

    RankMath really is a great plugin! Unfortunately, I’m having issues with canonical urls: When I create a new post, its url only shows up in the posts sitemap if I don’t give it a canonical url. For example, I have https://www.mydomain.com/blog/this-is-a-post/ as the automatically generated URL of my post. As this post is not only assigned to the category “blog” but also to the blog sub-category “subcategory”, I can also reach my post at https://www.mydomain.com/blog/subcategory/this-is-a-post/ – and this is what I want to set as my canonical url. But as soon as I do this, the post disappears from the sitemap. Before adding the canonical url, https://www.mydomain.com/blog/this-is-a-post/ is listed in the sitemap. After adding the canonical url it disappears and https://www.mydomain.com/blog/subcategory/this-is-a-post/ does NOT show up either. Posts that I created prior to using RankMath (before migration from Yoast) are listed in the sitemap, however.

    I use a plugin to create hreflang tags (https://wordpress.org/plugins/hreflang-tags-by-dcgws/) and I understand that other language versions of posts are not listed in the sitemap intentionally. And this is not the issue, but the issue is that also the main language version of the post doesn’t show up, and it doesn’t make a difference whether the hreflang tag plugin is active or deactivated. It just depends on the canonical url being present on the post’s “Advanced” RankMath tab. Also, when removing the canoncial url from a post, it doesn’t get deleted the first time after updating. It needs to be removed and updated a second time to be gone.

    To make sure it isn’t a caching issue, I have also excluded caching in the .htaccess file and W3 Total Cache as described here (https://rankmath.com/kb/exclude-sitemaps-from-caching/) and I tried flushing the cache as described here https://i.rankmath.com/pipRDp to make sure caching isn’t the issue. Also, I have set my CDN to “editing mode” in my web hosting panel, so this shouldn’t be interfering either.

    Also, I tried deactivating a plugin called “WP Last Modiefied Info” as it sometimes generates a php warning when accessing the sitemap, but this doesn’t solve the problem either.

    I’ll be very happy if you have a solution for this 🙂 Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Julia
    Rank Math free

    Addendum: I just read in a post on your support forum that custom canonical urls are not supported in RankMath – is this something that is going to change in future updates? This is really a core functionality. In the meantime I’ll try to disable RankMath’s sitemap functionality and add a sitemap via a different plugin. Please do not mark this thread as closed yet as I might have another question or two if my approach doesn’t work out 🙂

    Hello,

    Thank you for contacting Rank Math support, and sorry for any inconvenience that might have been caused due to that.

    Yes, when adding a custom canonical URL to a post, that post will not be included in the sitemap. Currently, we have no immediate plan for changing this behavior.

    Here’s a detailed guide with regard to this matter: https://rankmath.com/kb/url-not-in-sitemap/#custom-canonical-url

    With that said, if you have further issues with our plugin, just let us know. We are here to help.

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

The ticket ‘Canonical URL not showing in sitemap’ is closed to new replies.