Extension:DynamicWikiSitemap

The DynamicWikiSitemap extensions adds a separate sitemap page. It will update itself automatically, which is useful if you update your website on a regular basis.

The XML file has the following properties:
 * it is sorted by decreasing article popularity (ie. highest number of hits). However, you can configure it.
 * it contains articles only : no redirection pages, nor any other special/external page. However, you can configure it.

In order to produce more relevant Sitemaps, DynamicWikiSitemap Extension can also estimate the revision frequency of your pages and associate them a priority according various schemes.

Installation
Download the latest version and extract it into the root directory of your MediaWiki installation(the same directory that holds LocalSettings.php).

Note: No need to register the sitemap.php at LocalSettings.php(there you can only set configuration).

Note: The extension works properly only when installed in the root directory.

These actions is enough to install, but you can use URL Rewriting to make it URL more clean and simple.

URL Rewriting
First, create a .htaccess file, located at the root directory, or modify the .htaccess file you may already have:

If your wiki is not installed in the root folder of the site, and installed for example a folder /w/, /wiki/ or in any other, the URL Rewriting will look like this:

If, for example, on your website (example.com) has multiple wiki in different folders (example.com/wiki1), (example.com/wiki2), then the URL Rewriting will look like this:

Sitemap.php
If your wiki is not installed in the root folder of the site, you need to adjust a little file sitemap.php. To do this, open it (Notepad or any text editor such as Notepad++), then find the line:

And to add to them the path to the file:

Well, if your site has multiple wikis that in different folders /wiki1/, /wiki2/, you'll have to change the file path in each file sitemap.php.

Robots.txt
Do not forget to add to your robots.txt link to the site map. To do this, edit it by adding to the bottom line:

If your wiki is not installed in the root folder of the site, then the path to the map will look like this:

If your site has more than one wiki, you should specify the path to each map:

LocalSettings.php
Then add the following lines to your LocalSettings.php file (near the end):

This way, sitemap.php will allow us to automatically generate the content of the XML file (the real Sitemap). Each time search engine will try to open sitemap.xml, sitemap.php will be executed and will make an update of the XML file.

Configuration parameters
There are various options for extension, you can put them into your LocalSettings.php file line. However, extension should work even out-of box.

Exclude types of pages from sitemap

 * $wgDynamicWikiSitemapExclude: an array defining the excluded namespaces.
 * $wgDinamicWikiSitemapExclude : an array defining the excluded namespaces. Deprecated as of 0.1.3 version, July 2011 use  instead.

Setting base url other than $wgServer

 * $wgDynamicWikiSitemapServerBase: base url.
 * $wgDinamicWikiSitemapServerBase : base url. Deprecated as of 0.1.3 version, July 2011 use  instead.

Exclude pages from sitemap by name

 * $wgDynamicWikiSitemapExcludeSites: an array defining the excluded pages.
 * $wgDinamicWikiSitemapExcludeSites : an array defining the excluded pages. Deprecated as of 0.1.3 version, July 2011 use  instead.

Setting priority
You can use following priority schemes:
 * $wgDynamicWikiSitemapArticlePriority: the priority scheme to use in a tag. Default is.
 * $wgDinamicWikiSitemapArticlePriority : the priority scheme to use in a tag. Deprecated as of 0.1.3 version, July 2011 use  instead.
 * constant: all priorities is 0.5 (configuration constant );
 * linear: (configuration constant );
 * quadratic: (configuration constant );
 * cubic: (configuration constant );
 * exponential: (configuration constant );
 * smooth: (configuration constant );
 * random: (configuration constant );
 * reverse: (configuration constant ).

See various schemes for details.

Setting change frequencies

 * $wgDynamicWikiSitemapEstimateChangeFreq: enable to estimate the revision frequency. Default is false.
 * $wgDinamicWikiSitemapEstimateChangeFreq : enable to estimate the revision frequency. Deprecated as of 0.1.3 version, July 2011 use  instead.

Setting sitemap limit

 * $wgDynamicWikiSitemapLimit: maximum number of articles at a sitemap page. Default is 10000.
 * $wgDinamicWikiSitemapLimit : maximum number of articles at a sitemap page. Deprecated as of 0.1.3 version, July 2011 use  instead.

Note: At exceeding the number of pages, the sitemap works at sitemap index mode.

Setting sorting criterion

 * $wgDynamicWikiSitemapSortingCriterion: the sorting criterion of sitemap articles. Default is.
 * $wgDinamicWikiSitemapSortingCriterion : maximum number of articles at a sitemap page. Deprecated as of 0.1.3 version, July 2011 use  instead.

You can use following sorting schemes:
 * popularity:sort descending by popularity (configuration constant )
 * last revision:sort descending by last revision (configuration constant )
 * page ID:sort descending by page ID (configuration constant )

Note: At mode with sitemap index available only  sorting scheme.

Setting short URL

 * $wgDynamicWikiSitemapShortUrl: The base URL used to create sitemap page links at sitemap index mode.

Note: Requires URL Rewriting configuration.