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.

Comments |0|

Time limit is exhausted. Please reload the CAPTCHA.

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Legend *) Required fields are marked
**) You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>