Hello Griotta,
Thanks for reaching out regarding your sitemap.
First, Yoast generates an XML sitemap index for your site located at /sitemap_index.xml/. Just to be clear, do you mean that you find /en/negozio/ in the sitemap? You mentioned ‘sometimes’. Does this mean there are times that URL is not included? Also, can you please share the URL of your website for more context?
Hi @maybellyne,
it’s a company web site and I would like avoid to publish it here, please. Could we get on touch by E-Mail about this?
About your question, I was meaning that sometimes the URL is correct, not incorrect. Sometimes it is. I don’t know what cause it. I’m trying to discover it.
Just to be very clear, when the sitemap works correctly I see there:
/it/negozio/
/en/shop/
/it/negozio/categoria-prodotto/prodotto/
/en/shop/product-category/product/
When something is not working as well, the sitemap lists:
/it/negozio/
/en/negozio/
/it/negozio/categoria-prodotto/prodotto/
/en/shop/product-category/product/
So when something it’s not working well, the problem seems related only to the translation of the shop main page and only when the sitemap shows this page. The URLs of the products in fact are not influenced by this as you can see on my example. “Shop” is “shop” there. “Shop” is not “shop” only on the main page of the shop, but is “negozio” (first language slug).
I’d like send you the sitemap to show you what I mean exactly.
Thanks.
WPML support suggested a fix that I paste here:
Please try the following workaround:
– Go to wp-content/plugins/wp-seo-multilingual/classes/class-wpml-wpseo-xml-sitemaps-filter.php
Add the following code just above line 151 (the default case):
case 'product':
if ( class_exists( 'woocommerce') ) {
$this->sitepress->switch_lang( $lang_code );
$current_lang_shop_id = apply_filters('wpml_object_id', wc_get_page_id( 'shop' ), 'page', true, $lang_code);
$url = get_permalink( $current_lang_shop_id );
$lastmod = get_the_modified_time( 'c', $current_lang_shop_id );
$this->sitepress->switch_lang();
break;
}
Does it works for you?
Hi @griotta
We don’t accept support questions for the free plugin over email. This is the proper channel to request for support. If you were to upgrade to Yoast SEO Premium, then we’d be able to provide personal email support.
With that being said, could you check and make sure that everything is set up between Yoast SEO and WPML (and you have all of the necessary add-on plugins/additional setup) according to their documentation – https://wpml.org/documentation/related-projects/using-wordpress-seo-with-wpml/
We’d really also need a link to your sitemap in order to check the output further.
The fix suggested by WPML fixed the issue on our sitemap. They said that will add it on one of next WPML releases. Thanks the same for the support!