EXT: Google sitemap

Extension Key: dd_googlesitemap

Copyright 2009, Dmitry Dulepov, <dmitry.dulepov@gmail.com>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.org

Table of Contents

EXT: Google sitemap	1

Introduction	3

What does it do?	3

What it does not do?	3

Administration	4

If your home page is a shortcut...	4

News sitemap types	4

Better name for the sitemap	5

Sitemap autodiscovery	5

Other sitemaps	6

Introduction

What does it do?

This extension implements yet another Google sitemap for TYPO3.

There are several Google sitemap extensions for TYPO3 already. Why yet another another one?

There are several reasons why this extension is better than others. Here they are:

it correctly works with config.baseURL, config.absRefPrefix and domain records. Every other extension does not work with at least one of these settings and creates URLs like http://example.com/http://example.com/path/to/page

none of the existing extension currently create news sitemap correctly

all existing extensions are implements as normal plugins and thus do not perform well enough

Advantages of this extension:

correctly creates URLs

adds a date of last page modification

calculates page change frequency based on history of page updates

creates news URL correctly

uses eID feature, which offers much less load on the server

What it does not do?

This extension is made to be very fast and simple. It is not a universal sitemap extension for every record type. There will be no sitemaps for tt_products, tx_yourext_whatever or anything like that inside this extension. However this extension contains a way to connect external sitemap generators. Please, make them in your own extension if you wish.

This extension is coded solely for author's own projects and it will work as the author says. The author decided to make it public with the hope that it will be useful “as is” and without any guarantees or obligations.

No support whatsoever (see GPL v2).

Administration

The extension is ready to use immediately after installation.

To use the sitemap go to https://www.google.com/webmasters/tools/ and add the site to Google Webmaster console. Next add a sitemap for the site. Assuming that the web site name is http://example.com/ the URL of the sitemap is http://example.com/?eID=dd_googlesitemap. This all that has to be done to add a sitemap for pages.

You can use to additional parameters if number of items on the site is too large:

offset parameter will start the sitemap at a given position

limit parameter will tell how much items to put into the sitemap

These two parameters are valid for both pages and news and allow to create sitemaps that match Google requirements.

To add a sitemap for news (tt_news), use the following sitemap URL: http://example.com/?eID=dd_googlesitemap&sitemap=tt_news&pidList=123&singlePid=456. Two important parameters are:

pidList is a page id where news are located. If there is more than one sysfolder for news, their id values are separated with commas

singlePid is where the news item is displayed

That's all!

Notice that the news sitemap checks that news folder and single page is in the rootlline. To switch off this check use tx_ddgooglesitemap.skipRootlineCheck directive. This can be insecure in certain cases so it is recommended not to use this option.

If your home page is a shortcut...

If your home page is a shortcut, TYPO3 will automatically load Google sitemap in the context of the shortcut destination. Typically it results in a trucated sitemap (only pages below the shortcut destination). In order to fix this problem, set the tx_ddgooglesitemap.forceStartPid TypoScript option to the page ID where the sitemap should really start.

News sitemap types

Google has two sitemap types:

“normal” (yes, this is how it is called!)

“news”

Normal sitemap is used by a regular Google indexer. This is a sitemap type that this extension creates by default. It is suitable for normal indexing of sites and blogs.

News sitemap is used by the Google Reader to read news. If news from the web site should appear in Google Reader, add &type=news to the tt_news sitemap URL. This will force the script to create a Google Reader–friendly sitemap. Notice that normal Google indexer will ignore this sitemap completely. The Google Webmasters tools console will always show that zero URLs from the news sitemap is indexed. It is strongly recommended to put sitemap for tt_news in “normal” format to Google too.

For more information see the news sitemap specification.

You can supply a TypoScript object to make your own link. This will let you to add date to the link, for example. See here for details.

Better name for the sitemap

You can use mod_rewrite to refer to the sitemap as a sitemap.xml. Some people prefer this even though there is no any practical reason to do this. Google is happy with the default URL. Here is the rule:

RewriteRule sitemap.xml$ /index.php?eID=dd_googlesitemap [L,R=301]

Sitemap autodiscovery

If you'd like your sitemap to be discovered by search engines automatically, you can put them to your robots.txt like this:

Sitemap: http://example.com/sitemap.xml

Other sitemaps

Developers can add other sitemaps to dd_googlesitemap from separate extensions. Extensions must provide a usual TYPO3 userFunc and register it in the configuration like this:

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dd_googlesitemap']['sitemap']['t3blog'] = 'tx_t3blog_sitemap->main';

Here t3blog ext would add a sitemap of type t3blog to dd_googlesitemap. The sitemap can be generated using the following URL:

http://example.com/?eID=dd_googlesitemap&sitemap=t3blog

Developers are encouraged (but not required) to use tx_ddgooglesitemap_generator class as a base for their sitemap generators.

Note that generators are new and may slightly change in the next versions. Please, stay on look out for updates!

EXT: Google sitemap	EXT: Google sitemap

2

EXT: Google sitemap

Dmitry Dulepov

2009-02-24T09:49:12