Multilingual patch for “Google (XML) Sitemap Generator for WordPress”

Google (XML) Sitemap Generator for WordPress (next is called as Sitemap Generator only) is one of “you must install” WordPress plugin. This plugin automatically make a sitemap that is said is also one element of Search Engine Optimization (SEO). Unfortunately, until this writing, Sitemap Generator v3.1.2 release December 26, 2008 does not yet support multilingual blog. Sitemap Generator can not make the contents of the blog URL instead of the default language.

SulhanSetiawan.com is written in two languages, Indonesia (default) and English (en code). Multilingual made with qTranslate with pre-path mode. The Sitemap can be seen here, like the screenshot below.

Sitemap SulhanSetiawan.com

Sitemap of SulhanSetiawan.com

See that there are insertions /en/ on the URL to the content of the English-language blogs. Sitemap has not supported as exemplified by Sitemap Generator v3.1.2. Therefore, in the file sitemap-core.php on GoogleSitemapGenerator class, replace the function addurl to be as follows:

function AddUrl($loc,$lastMod=0,$changeFreq="monthly",$priority=0.5){
    $page = new GoogleSitemapGeneratorPage($loc,$priority,
                 $changeFreq, $lastMod);
    global $q_config;
    foreach ($q_config['enabled_languages'] as $language) {
      $urleach=qtrans_convertURL($loc, $language,true);
      $page->SetUrl($urleach);
      $this->AddElement($page);
    }
}

Just look at the results. Go to the wp-admin, go to the Sitemap Generator plugin, do the rebuild sitemap. Your new sitemap usually on http://yourblog/sitemap.xml.

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.
Please notice that comment or question submitted should match the topic. Otherwise, we will delete that comment or question :!:

Leave a comment

Before making a comment, make sure you have read the previous comments. Do not make the questions have been asked. Note also the links in the article. Take a look at those links before you create the questions, as it may be an explanation of your questions have been answered in that link.

Comments that do not follow these rules will be deleted!

(required)

(required)


Time limit is exhausted. Please reload the CAPTCHA.