Manual:GenerateSitemap.php

Details
generateSitemap.php file is a maint-scripts>Special:MyLanguage/Manual:Maintenance scripts|maintenance script to generate a [http://www.sitemaps.org/ sitemap] for a MediaWiki installation. Sitemaps are files that make it more efficient for search engine robots (like googlebot) to crawl a website (so long as the bot supports the sitemap protocol.)

By default, the script generates a sitemap index file and one gzip-compressed sitemap for each namespace that has content. See options>Special:MyLanguage/Manual:GenerateSitemap.php#Options|#Options for a list of options that can be passed to the script.

You may need to set up a cron job to update the sitemap automatically.

In MediaWiki 1.16.0 the sitemap generated by the script does not work with Google. You need to patch the script with bugfix>#A BUG FIX to work the Google Webmaster Tools|this first.

For generic instructions on using MediaWiki's maintenance scripts, see .

Related settings in LocalSettings.php
Array of namespaces to generate a Google sitemap for, or false if one is to be generated for all namespaces. The default setting is.

Custom namespace priorities for sitemaps. This should be a map of namespace IDs to priority. The default setting is.

Options
 

displays the available options for generateSitemap.php

 

The file system path to save to, e.g sitemap/. Note, this directory must be viewable online!

 

What site identifier to use for the wiki, defaults to 

 

The URL that points to --fspath</tt></>, e.g.
 * http://wiki.example.com/sitemap/

If specified, gets prefixed to the filenames in the sitemap index. This is needed because some search engines *cough*Google*cough* require absolute URLs in sitemaps. You should specify --server</tt> also; the values will often be similar, but having them separate allows the script to accommodate even unusual setups.

 

The protocol and host name to use in URLs, e.g.
 * http://en.wikipedia.org

This is sometimes necessary because server name detection may fail in command line scripts and will show up only as "localhost" or "my.servername" in the xml files.

 

Whether or not to compress the sitemap files. The default setting is <tvar|yes> </>.

Example
Creating a sitemap for Google Webmaster Tools:

First (in $IP):

Then:

Alternative
Extension for manual sitemap generation