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.
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.