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.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | gsitemap_0.patch | 786 bytes | Bodo Maass |
| #8 | gsitemap_i18n_multilanguage.zip | 16.33 KB | Bodo Maass |
Comments
Comment #1
SamAMac commentedI 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?
Comment #2
he_who_shall_not_be_named commentedI used the internationalization module
Comment #3
Marc Bijl commentedHmm. 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:
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
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:
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...
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.
Comment #4
igrcic commentedNot 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...
Comment #5
corvy commentedI 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.
Comment #6
The.Clue commentedif 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 :)
Comment #7
The.Clue commentedneither:
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 :(
Comment #8
Bodo Maass commentedThis 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).
Comment #9
Bodo Maass commentedstatus changed to 'patch (code needs review)'
Comment #10
Bodo Maass commentedJust 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).
Comment #11
Bodo Maass commentedMy 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.
Comment #12
The.Clue commented#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 :)
Comment #13
pdb commentedThe 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.
Comment #14
belio commentedany updates on this?
Comment #15
faqing commentedWhat 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.):
You just change my sitename (www.ibc.ac.th) to yours.
Comment #16
darren ohhook_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.