Spanish Translation Sitemap

#13210
  • Resolved Glenn
    Rank Math free

    I have Spanish translated pages on my site however google is seeing them as duplicate content. I am using Translatepress.com and they assure me that their plug-in clearly identifies the pages as alternative language in HTML but suggested I generate a sitemap of the translated pages for google search. The problem is their plugin works with Yoast to generate the sitemap. Is there a way that Rankmath can generate a sitemap of the Spanish translated pages? Second, maybe this is an opportunity for RankMath to extend their brand with Translatepress.com as you both are great plug-ins and I do not like Yoast at all (bloated).

    Thanks!

    • This topic was modified 5 years, 4 months ago by Glenn. Reason: added login credentials
Viewing 4 replies - 1 through 4 (of 4 total)
  • Glenn
    Rank Math free

    Hello,

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

    Thank you.

    Hello,

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

    Translatepress does not seem to adding the hreflang tag on the translated pages which is required to tell Google that there are different language versions of the page.

    You can workaround this by generating the hreflang tags for the translated pages and manually add them to the sitemap using the below code:

    /**
     * Filter to add extra URLs to the XML sitemap by type.
     *
     * Only runs for the first page, not on all.
     *
     * @param string $content String content to add, defaults to empty.
     */
    add_action( 'rank_math/sitemap/{$type}_content', function() {
      
    });
    function rank_math_add_custom_dynamic_url( $urls ) {
        $urls .= '
            http://www.mysite.com/dynamic-category1/
            2019-02-22T18:02:24+00:00
        ';
    
        $urls .= '
            http://www.mysite.com/dynamic-category2/
            2019-02-22T18:02:24+00:00
        ';
    
        return $urls;
    }

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Glenn
    Rank Math free

    To make sure I understand, I need to generate hreflang tags for each affected page and add that makeup to each page along with your php code above to each affected page, correct?

    Once added manually, what happens if the theme or plugins update? The makeup be erased, correct?

    HI Glenn,

    Thanks for the follow up.

    You will need to generate and add the individual links to the filter as a separate $url.
    This code need to be added to your child theme’s functions.php file and not to each page.

    I hope this info helps. 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 4 replies - 1 through 4 (of 4 total)

The ticket ‘Spanish Translation Sitemap’ is closed to new replies.