Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 11 replies, has 8 voices.

Last updated by luisC-15 6 years, 4 months ago.

Assigned support staff: Andrea.

Author Posts
July 15, 2013 at 5:54 am #144633

Saumil

Hello,

I am using the latest versions of WPML and Yoast WordPress SEO plugins. I am trying to create a separate XML sitemap for each language that we have on the website. We are currently using the -- hidden link -- option.

You can see the site at -- hidden link

Language options are at --

hidden link
hidden link
hidden link
hidden link
hidden link

The sitemap that got created is at -- hidden link

The page sitemap lists all the pages in the same sitemap irrespective of the language folder demarcation. I want to create separate XML sitemaps for each of the languages being used and need to know how can I do that.

Kindly let me know.

Regards,

Sam

July 15, 2013 at 6:58 am #144640

Andrea
Supporter

Dear Sam,

When you use WPML 2.4.2 together with WordPress SEO (version 1.1.1 and above), you’ll get individual sitemaps – one per language.

Please see details here: http://wpml.org/2011/12/wpml-2-4-2-content-duplication-and-wysiwyg-custom-fields/
Scroll down to "SEO Love with Per-Language Sitemaps".

I hope this helps.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have

July 15, 2013 at 7:18 am #144652

Saumil

Hello Andrea,

Thanks a lot for your reply. I see that in the link you have mentioned, there is no step required to be taken on my side to get the individual sitemaps, is that right? Does it happen automatically? Or do I have to do something to get the favorable output?

The reason I ask is because, I have already set-up the WordPress SEO plugin and the sitemap generated at -- hidden link -- is not ideally how it should be like with the language demarcation.

Can you please guide me on what I might be missing out on?

Regards,

Sam

July 15, 2013 at 11:21 am #144751

Andrea
Supporter

Dear Saumil,

The article I've linked focuses on "languages-per-domains", that is not your case.

On solution is provided here: http://wpml.org/forums/topic/multisite-y-google-webmaster-tool/#post-112898

It's in Spanish, but in short, just add this code to your functions.php:

if (isset($sitepress)) add_filter('wpseo_posts_join', 'sitemap_per_language', 10, 2);
function sitemap_per_language($join, $type) {
    global $wpdb, $sitepress;
    $lang = $sitepress->get_current_language();
    return " JOIN " . $wpdb->prefix . "icl_translations ON element_id = ID AND element_type = 'post_$type' AND language_code = '$lang'";
}

Then, on Google Webmaster Tools, add your sitemaps, one per language. For instance:

hidden link (default)
hidden link
hidden link
hidden link

Please note that you must use more than one file for each language:
- category-sitemap.xml
- post-sitemap.xml
- page-sitemap.xml

Which name to use, depends on how your sitemap is built, but you can get an idea looking at your sitemap_index.xml (that, as far as I can see, it only contains "page-sitemap.xml").

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

July 16, 2013 at 11:38 am #145326

Saumil

Thanks a lot, Andrea!

The solution worked perfectly.

Thanks a lot for all the help.

Regards,

Sam

January 30, 2014 at 10:50 am #330404

Xavier

This solution is not working for global XML sitemap as hidden link

May 23, 2014 at 8:55 am #405846

Fundación

Hi Andrea,

I am working on a website in different languages and I am using the last versions of WPML plugins and YOAST SEO.

I tried the solution you post above, inserting that code in the functions.php of my theme, and now I have a sitemap_index for each language:

hidden link
hidden link
hidden link
hidden link

The problem is that these sitemap_index are the same in all languages, their links point only to the original language (english).

However, the other sitemaps are created right, for example:

hidden link
hidden link

Is this the expected behaviour?

Might this be a problem for a correct Google indexation?

Should I avoid to send to webmaster tools the sitemap_index on the other languages different from english?
For example, should I just send for the spanish language hidden link these three sitemaps:

hidden link
hidden link
hidden link

But not the sitemap_index: hidden link

Thanks in advance,
Victor

May 23, 2014 at 7:53 pm #406273

Fundación

Just in case, I will start a new thread.

Thanks

September 17, 2014 at 10:16 am #473291

keesjanD

is this still how it works,
still no proper solution for languages in maps like:
/
/en/
/nl/
/fr/

October 20, 2014 at 7:07 am #495019

Craig

I have added the code snippet also and sitemaps still dont work even in:

/sitemap_index.xml
/en//sitemap_index.xml

Any ideas?

September 15, 2015 at 12:08 pm #704513

michelv-8

I use version 3.1.9.7 and i have problems for the xml files. The are the same. No link to /en/

/sitemap_index.xml
/en/sitemap_index.xml

I hope someone can help me?
I already use the extra php code in functions.php in my theme (cherry).

February 6, 2017 at 9:49 pm #1201020

luisC-15

Hi,

I just found this thread and currently have a website that is in both English and Spanish but don't see automatic separation of languages within the website.

hidden link