Mainly Wordpress advices

qTranslate support for »Google XML Sitemaps« plugin

Having qTranslate, multilingual WordPress plugin, installed, brings some problems – between them are slower performance and incompatibility with other plugins. It is said, that having a XML sitemap helps you climb on Google rankings. And you can find a few plugins which support this. One of them is Google XML Sitemaps but it has a broken qTranslate support. This was fixed by a forked Google XML Sitemaps with qTranslate Support, but unfortunately it is not up to date and doesn’t translate categories and tags.

So, some coding was needed. To transfer the enhancement to the original plugin, I wrote two functions, which are stored in a separate file, so the new code does not intermingle with the original one. I also enhanced the functionality, so that besides URLs for home page and posts, the URL is translated for categories, tags, archives and author pages. It also works as correctly for enabling/disabling qTranslate’s “hide_default_language” option.

Update on 3rd of June: Corrected display of “last modification time” in “sitemap-qtranslate.php”.Update on 4th of June: Corrected URL translations when not using qTrasnlate option “URL Modification Mode” set to “Use Pre-Path Mode”.Update on 19th of August: The code was packed as an official WordPress plugin.

Thank you for reporting and correcting this problem. I made a little different solution: removed the “trailingslashit” function from “sitemap-qtranslate.php” and added it for translating only the home URL.

Hello, your patch looks promising. Any chance it does also work with “qTranslate slug with widget” sub-plugin which allows for translating the slugs of qT-translated posts/pages and stores the extra slugs in an extra, custom DB table?

Hi DSmidge, I tried but no luck. I also looked at the code of ‘qtranslate-slug-with-widget.php’ and tried to use filters it registers, e.g. qTranslateSlug_page_link() with your patch, but no luck either. Instead of digging deeper, I decided to generate the other language sitemaps separately for this one site where I need this. I still would like to thank you for your work with this useful patch: works like a charm w/ default qTranslate slugs. Cheers.

Hi,
use “qTranslate” and “Google XML Sitemaps v3 for qTranslate”
also use the plugin “qTranslate slug with Widget” the latter crete a permalink post or page in multiple languages ​​through the title.
But it does not work with your plugin, takes the title of the default language.
how can you fix this problem?

I also have the problem that the Google XML Sitemaps for qTranslate does not work correctly with the qTranslate slug plugin. The sitemap is generated but it does not generate the URLs inserted into the qTranslate slug plugin correctly. Also the chosen language of the WP Admin tool affects the sitemap creation.

I’m sorry I don’t reply sooner. As it is stated on the page, this plugin is a fork of “Google XML Sitemaps”. I only added features I needed and I don’t have lot of spare time to enhance the plugin further.

Unfortunately, I wasn’t successful with enabling slugs translation support. In my installation the categories don’t work (it doesn’t save the slugs), tags are not yet supported. I didn’t look at the pages yet.

The changes I made trying to translate slugs on posts can be downloaded here. I called “qTranslateSlug_post_link” but all it did was translating the links to default language. Any suggestions?

Hi , this is really a great thing having qtranslate and xml sitemap work together . but can I ask what is the reason to leave it like a fork ? why not integrate it as a native support on the original xml sitemap plugin ?

Sorry for the late answer. This plugin is modified to work with qTranslate – a plugin which enables you to write posts in multiple languages. With a generic XML Sitemaps plugin, the sitemap will only contain entries for default language.