Google Sitemap

That’s a piece of cake! You just have to install extension  dd_googlesitemap.

You are now able to register the generated sitemap, available on  http://www.domain.tld/?eID=dd_googlesitemap in Google Webmaster Tools.

In order to prevent you having to register your sitemap, you may create a file robots.txt at root of your website with following content:

Sitemap:  http://www.domain.tld/?eID=dd_googlesitemap

Multilingual Website

You’ve got a multilingual website? Then you’ll have to register as many sitemaps as you configured languages for your website. The URLs are simply:

However if as for myself you cannot even think having to do this boring job of registering all these entries, you may create a sitemap that will contain all language entries using script below (sitemap.php). This script should be saved at root of your TYPO3 install in order to be acccessible from URL  http://www.domain.tld/sitemap.php.

Beware : This script takes for granted that all URLs are generated with the language prepended (on 2 characters), even for default language. This means that if English (“en”) is configured as default language, all URLs will be prepended with “/en/” [1]. You should of course change the list of languages according to your own configuration and update file robots.txt if you used the trick ;-)

<?php
$languages = array(
	'default' => '0',
	'de' => '1',
	'fr' => '2',
	'it' => '3',
	'en' => '4',
);
 
$url = 'http:'.'//' . $_SERVER['HTTP_HOST'] . '/?eID=dd_googlesitemap&L=';
 
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>' . chr(10) .
	'<urlset xmlns="http'.'://www.sitemaps.org/schemas/sitemap/0.9">' . chr(10);
 
$defaultLanguage = '';
$l = 0;
 
foreach ($languages as $language => $uid) {
	if ($language == $defaultLanguage) continue;
	$c = 0;
 
	$fh = fopen($url . $uid, 'r');
 
	while (!feof($fh)) {
		$buffer = fread($fh, 1024);
		if ($c == 0) {
				// Remove start tags
			$buffer = substr($buffer, strpos($buffer, '<url>'));
		}
		if ($l == 0) {
				// Extract the default language
			if (preg_match('|http://.*?/(..)|', $buffer, $matches)) {
				$defaultLanguage = $matches[1];
			}
		}
			// Remove end tag
		if (substr($buffer, -9) == '</urlset>') {
			$buffer = substr($buffer, 0, -9);
		}
		echo $buffer;
		$l++; $c++;
	}
	fclose($fh);
}
 
echo '</urlset>';
?>
Flattr