On a multilanguage site I observed that Google sitemaps doesn't display all my pages (the xml). So I added one for each language:

http://para.ro/en/gsitemap, http://para.ro/ro/gsitemap, http://para.ro/hu/gsitemap.

They are totally different which isn't good.

Comments

SamAMac’s picture

I have been playing with the locale module, and I am curious how you set up the three sites in different languages. Did you set a variable in the settings.php or something?

he_who_shall_not_be_named’s picture

I used the internationalization module

Marc Bijl’s picture

Title: different sitemaps for a single site. » different sitemaps for a single multi language site.

Hmm. Same kind of issue here...

At a previous multi language site I created with Drupal, i18n module and gsitemap module, I get two sitemap xml files which are showed well in browsers but have wrong content:

  1. example.com/nl/gsitemap
    this is a sitemap with URL's of all nodes, but whatever language the node is, they all have language prefix nl (so example.com/nl/dutch-node as well as example.com/nl/english-node). This means a wrong URL in 50% of the cases
  2. example.com/en-local/gsitemap
    this is a sitemap with URL's of all nodes, but whatever language the node is, they all have language prefix en-local (so example.com/en-local/dutch-node as well as example.com/en-local/english-node). This also means a wrong URL in 50% of the cases

At a current multi language site I'm working on, using the most recent version of the same modules, I get two sitemap xml files which are showed wrong in browsers but -seem to- have right content:

  1. example.com/nl/gsitemap
    this is a sitemap with URL's of dutch nodes only, all with the correct language prefix (so example.com/nl/dutch-node). However the xml is showed as a huge line of text in both Firefox and Opera. Strange enough, Internet Explorer is the only browser doing a good job...
  2. example.com/en-US/gsitemap
    this is a sitemap with URL's of english nodes only, all with the correct language prefix (so example.com/en-US/english-node). However the xml is showed as a huge line of text in both Firefox and Opera. Here too: strange enough, Internet Explorer is the only browser doing a good job...

It's clear I have some things that need to be solved here... Hope that someone at the drupal forum knows how to setup the gsitemap module for multi language sites.

igrcic’s picture

Not me :(
I tried to submitt two different sitemaps on google but it says for www.mysite.hr/en and www.mysite.hr/hr, but it says gsitemap must be installed on root dir :(

dunno what to do...

corvy’s picture

I did it now, but I am still windering how it is going to work.

I have two langs. en/ and no/, each with its own sitemap. I added the following in htaccess:

RewriteRule ^engsitemap en/gsitemap [L,QSA]
RewriteRule ^nogsitemap no/gsitemap [L,QSA]

So now I can access https://www.jabber.no/engsitemap and https://www.jabber.no/nogsitemap. These are both submittable to google.

I dont know how it will affect indexing but we will see.

The.Clue’s picture

Version: 4.6.x-1.x-dev » 4.7.x-1.x-dev

if u have not access to .htaccess to add needed rewrite rules, to avoid google error about sitemaps not in root, use unclear url instead:

http://www.systemeden.com/?q=en/gsitemap

only a bug about this: in google sitemaps table for your website it will not show the name.

...but better than nothing :)

The.Clue’s picture

neither:

RewriteRule ^engsitemap en/gsitemap [L,QSA]
RewriteRule ^nogsitemap no/gsitemap [L,QSA]

or:

RewriteRule ^engsitemap index.php?q=en/gsitemap [L,QSA]
RewriteRule ^itgsitemap index.php?q=it/gsitemap [L,QSA]

actually works for me, anyway :(

Bodo Maass’s picture

StatusFileSize
new16.33 KB

This is a general problem with i18n. It always translates urls to the current language of the query. But in same cases where all content should be listed (such as for the sitemap), we don't want the urls to be translated into the query language.
I have fixed this by patching i18n.module to have a switch for translating urls into the node language instead of the requested language. Whenever a multi-linguage node list should be created, the switch has to be set to node language and restored afterwards. This is inelegant in the sense that the other modules have to check if i18n is present and throw the switch if appropriate, but I can't think of another way to to this.
Attached is a zip file with patches against 4.7.3 and my actual copies of those files (Note: My i18n has a few other patches in addition to the translation switch).

Bodo Maass’s picture

Status: Active » Needs review

status changed to 'patch (code needs review)'

Bodo Maass’s picture

Just to clarify this, the patch in my previous post #8 changes gsitemap to create a single sitemap with all node urls in their correct language (such as en/about and de/info).

Bodo Maass’s picture

StatusFileSize
new786 bytes

My previous patch only worked if the content selection mode of i18n was set to "All content" (in admin/settings/i18n/Advanced). Here is another version of the patch that should work with all content selection modes.

The.Clue’s picture

#11 works for me in my testing environment (clean Drupal installation with only gsitemap and i8n module). I'll test it on my "real" websites in the following days and I'll post another follow up :)

pdb’s picture

The patches have sadly been messing up the absolute URLs in my menu. It prepends the language to all of them, as in
http://pdb.homelinux.net/gallery becomes /en/http://pdb.homelinux.net/gallery which of course doesn't work.

I don't have enough of an understanding of the i18n functions that are being modified and called for all links to be able to see where the mistake is.

belio’s picture

Status: Needs review » Needs work

any updates on this?

faqing’s picture

What I did is to submit one sitemap to Google.
Here is the sitemap.xml file i submit to Google (my site has three drupal running, they don't share anything, because they are different languages and maintened by different people.):

<?xml version="1.0" encoding="UTF-8"?>
   <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <sitemap>
      <loc>http://www.ibc.ac.th/en/gsitemap</loc>
      </sitemap>
   <sitemap>
      <loc>http://www.ibc.ac.th/ch/gsitemap</loc>
       </sitemap>
   <sitemap>
      <loc>http://www.ibc.ac.th/faqing/gsitemap</loc>
       </sitemap>
   </sitemapindex>

You just change my sitename (www.ibc.ac.th) to yours.

darren oh’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Needs work » Closed (works as designed)

hook_gsitemap() now allows modules to associate extra links with nodes, terms, and users. The idea of listing a site map for each language in the index is interesting, but should be pursued in a new issue.