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

Sebelum membuat komentar, pastikan Anda telah membaca komentar-komentar sebelumnya. Jangan membuat pertanyaan yang telah ditanyakan. Perhatikan pula link-link dalam artikel. Lihatlah link tersebut sebelum membuat pertanyaan, karena mungkin penjelasan dari pertanyaan Anda telah di jawab dalam link tersebut.

(required)

(required)


*

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