I18N Sitemap Parent Fix

Downloads: 80
Category: Plugin
Compatible with: GetSimple 3.3 - 3.3

Last Updated: April 28, 2022
Tags: i18n sitemap parent
Author: Knobbles

(2.5) 4 Votes

Plugin Description:

When sitemap.xml is generated by i18n base plugin, there might occur a problem with the <loc> path.
In lhis case, in all <url> entries for languages other than the default language, the parent slug is missing in the path.
This makes the path in the sitemap different from the canonical path.

This small plugin tries to fix this.
For each sitemap entry, when the parent part is missing in the path, it will find out the parent from the default language slug and insert that one into the path.

ATTENTION: MANUAL CODE EDITING REQUIRED!

The multilingual sitemap is generated in file sitemap.class.php in the function I18nSitemap::generateSitemapWithoutPing.

Unfortunately, there is no call to handle the sitemap filter this plugin makes use of.
So you must manually add this call in the plugin source code!

Therefore, in file /plugins/i18n_base/sitemap.class.php, before line 60 (" //create xml file"), you will have to manually add the line:

  $xml = exec_filter('sitemap',$xml);

After this, the source will look like that:

    }
    $xml = exec_filter('sitemap', $xml);
    //create xml file
    $file = GSROOTPATH .'sitemap.xml';
    XMLsave($xml, $file);
}

Now the plugin will be called each time the sitemap is generated and the <loc> is fixed..

Install Instructions:

Unzip and upload the file (it is only one file) to your plugins directory, then activate. There are no configuration options.

After this, edit the source code of file /plugins/i18n_base/sitemap.class.php as described.