Modification of the TYPO3 extension mc_googlesitemap
The extension mc_googlesitemap is the de-facto standard for generating XML sitemaps with TYPO3 to help search engines. In version 0.4.2 (stable) the extension can be downloaded from the TYPO3 Repository. Using this extension is rather unspectacular. Nonetheless it has two "glitches":
- If the root page is not a shortcut to the very startpage (means, the root page already contains the startpage contents), the extension generates a faulty link for the startpage entry in the sitemap. It would just say "/" instead of "http://domain.tld/"
- If absRefPrefix is activated, all entries in the sitemap are double prefixed with the domain.
(a.e. "http://domain.tld/http://domain.tld/anypage/etc/")
The first effect...
... does not happen, if the rootpage actually is a shortut to the very startpage. For various reasons this is the standard in many TYPO3 installations. Therefor quite some TYPO3 users won't ever notice.
FIX: The file class.tx_mcgooglesitemap_base.php has to be patched. Function "createElement" (from line 287):
Before:
function createElement($array) {
$linea[]="\t
$linea[]="\t\t
$linea[]="\t\t
After:
function createElement($array) {
$linea[]="\t
if ($array['loc'] == "/") { $array['loc'] = "http://domain.tld/"; }
$linea[]="\t\t
$linea[]="\t\t
Appearently "domain.tld" has to be changed to the real domain...
The second effect...
... well, what can I say. Using absRefPrefix is not recommended by the TYPO3 folks. Using it causes some problems, since quite some extensions (and this as well) can't deal with it. Nonetheless I've become a big fan of absRefPrefix. I'll come to my reasons in a later article.
FIX: The file class.tx_mcgooglesitemap_base.php has to be patched. This time line 72:
Before:
$this->baseUrl='http://'.$host.'/'.$path;
After:
$this->baseUrl=$path;
"'http://'.$host.'/'." will be removed. So mc_googlesitemap is not prefixing the domain by itself anymore. This is now solely handled by absRefPrefix.


