According to sitemap specification
https://support.google.com/webmasters/answer/189077?hl=en
If page X links to page Y, page Y must link back to page X. If this is not the case for all pages that use hreflang annotations, those annotations may be ignored or not interpreted correctly.
It means that sitemap must generate URL elements for all pages, including all translations.
As it is in example (on the same page).
But currently it generates only all pages once with translations added as alternate links.
Attaching file with fix which works on multilingual site
sitemap.php.zip
Basically I have added another loop to create url enties for all translations too
And changed url generation for alternate links, because instead of page url it was using the route which may be different for pages if slug is entered (which is not the same as folder)
foreach($entry_translated as $lang => $page_route) {
//$page_route = $page->rawRoute();
if ($page->home()) {
$page_route = '';
}
$entry->translated[$lang] = '/'.$page_route;
According to sitemap specification https://support.google.com/webmasters/answer/189077?hl=en If page X links to page Y, page Y must link back to page X. If this is not the case for all pages that use hreflang annotations, those annotations may be ignored or not interpreted correctly.
It means that sitemap must generate URL elements for all pages, including all translations. As it is in example (on the same page).
But currently it generates only all pages once with translations added as alternate links.
Attaching file with fix which works on multilingual site sitemap.php.zip
Basically I have added another loop to create url enties for all translations too
See:
And changed url generation for alternate links, because instead of page url it was using the route which may be different for pages if slug is entered (which is not the same as folder)