Filter to eliminate non-canonical post versions from posts sitemap

#307631
  • Resolved Nc
    Rank Math free

    Hi,

    I use WP Multilang as multilanguage plugin. I configured it so that:
    – All site pages are translated in PT, EN, ES
    – All site blog posts are “triplicated” (not translated) in PT, EN, ES.

    The canonical tag that I generate manually in functions.php tells google which is the canonical post. Most of the posts the canonical is the PT version, 5 of them is the EN version. None is the ES version.

    This are the sitemap generated by rankmath:

    https://www.capitalinvest-group.com/sitemap_index.xml

    https://www.capitalinvest-group.com/pt/page-sitemap.xml

    https://www.capitalinvest-group.com/pt/post-sitemap.xml

    Page sitemap is ok. As it shows all versions of every page (that are all translated).

    Post sitemap is wrong. It show all version of every post, but only 1 is the canonical. Therefore in the posts sitemap there are canonical and non-canonical versions of every post.

    Is there a filter I could use on functions.php to manually adjust the posts sitemap generated by rankmath so that the 2 non-canonical versions of each post are suppressed from the sitemap?

    This would mean:
    i) Eliminate the ES versions of all posts (none are in ES)
    ii) Eliminate the PT versions of 5 posts (5 posts are in EN)
    iii) Eliminate the EN version for the rest of the posts (all posts but 5 are in PT)

    Thanks in advance!

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

    We have shown you that this function can indeed work but due to the nature of the complexity of your website and the custom code used to make everything work this level of customization of our filters fall outside the scope of our support.

    You can see the full list of available filters from our plugin here: https://rankmath.com/kb/filters-hooks-api-developer/

    You can also check this page to learn how to include custom made sitemaps inside our plugin: https://rankmath.com/kb/custom-sitemaps/

    Apart from this, the final customizations need to be done by you or some developer you can hire for this purpose.

    Don’t hesitate to get in touch if you have any other questions.

    Nc
    Rank Math free

    Dear Miguel,

    Let me understand if I understood you correctly:

    i) Rankmath filter ‘rank_math/sitemap/entry’ does not work in this case as it is unable to eliminate from sitemap single posts. It eliminates all 3 versions (in PT, EN and ES) of every post. Right?

    ii) Rankmath filter “rank_math/sitemap/xml_post_url” also does not work, because rankmath canonicals are disabled (they are disabled and I add them manually because they were wrong: all translated version of pages are canonicals, only 1 version of the posts is canonical).

    So, in summary all the suggestions that you made me in the past week do not work.

    Do you have any other suggestion that could work?

    Therefore, I had to disable rankmath’s sitemap generator, and I used this link to generate it by scanning the site: https://www.sureoak.com/seo-tools/google-xml-sitemap-generator

    It worked perfectly and it is on http://www.capitalinvest-group.com/21-12-20-sitemap-sureoak.xml

    Google now has a correct sitemap, but unfortunately, I would have to update it every time a new post is added.

    Any chance that rankmath could generate a correct sitemap? Anyway to correct rankmath sitemap by using any filter that could work? Any chance to make rankmath fully compatible with WP Multilang, including sitemmap generation?

    Any other suggestion?

    Hello,

    All the filters we have available are on the page that we shared previously and the only other way to change the sitemap generation without those filters is with the custom sitemaps option we mentioned as well.

    We don’t have any hidden filter or functionality related to sitemaps. All the information is on the pages we shared earlier.

    If you would like the compatibility list of multilingual plugins with Rank Math you can check this page: https://rankmath.com/compatibility/

    Don’t hesitate to get in touch if you have any other questions.

    Nc
    Rank Math free

    Thanks Miguel,

    As rankmath does not offer any filter/ option to make adjustments for the sitemap, we really will have to generate the sitemap in another way (ex: using another plugin or coding it in functions.php).

    What would be a advantage of including any custom generated sitemap in rankmath?

    Wouldn’t it be more practice just to deactivate rankmath’s sitemap module?

    Thanks

    Hello,

    The practicality of adding a custom sitemap to Rank Math is that you would be able to still get the perks of an automatically generated sitemap just with the custom functionality that you wanted.

    Another alternative would be to create that custom functionality to generate the sitemap outside Rank Math as you correctly mentioned.

    For example, if you create some sort of loop to get the appropriate URLs and add them inside the custom sitemap, that would essentially be an automatic sitemap.

    Don’t hesitate to get in touch if you have any other questions.

    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 - 16 through 20 (of 20 total)

The ticket ‘Filter to eliminate non-canonical post versions from posts sitemap’ is closed to new replies.