Extension:DynamicWikiSitemap
|
DynamicWikiSitemap Release status: stable |
|||
|---|---|---|---|
| Implementation | Data extraction | ||
| Description | Adds a separate sitemap page. | ||
| Last version | 1.0.0 (2011-11-29) | ||
| MediaWiki | 1.15.0+ | ||
| License | GPL | ||
| Download | Download code | ||
|
|||
|
Check usage (experimental) |
|||
Contents |
[edit] What can this extension do?
DynamicWikiSitemap is a separate sitemap page. A sitemap will update itself automatically, which is useful if you update your website on a regular basis.
DynamicWikiSitemap don't creates any special pages.
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.
[edit] 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.
[edit] URL Rewriting
First, create a .htaccess file, located at the root directory, or modify the .htaccess file you may already have:
Options +FollowSymlinks
RewriteEngine on
# Link for the Sitemap
RewriteRule ^sitemap(.*)\.xml$ sitemap.php?page=$1 [L,NC]
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.
Then add the following lines to your LocalSettings.php file (near the end):
$wgDynamicWikiSitemapShortUrl = "sitemap$1.xml";
[edit] Configuration parameters
There are various options for extension, you can put them into your LocalSettings.php file (before the "require once") line. However, extension should work even out-of box.
[edit] Exclude types of pages from sitemap
- $wgDynamicWikiSitemapExclude
- an array defining the excluded namespaces.
$wgDinamicWikiSitemapExcludean array defining the excluded namespaces.Deprecated as of 0.1.3 version, July 2011 use $wgDynamicWikiSitemapExclude instead.
# Exclude pages from sitemap (value "1" means "exclude"): #Please refer to #http://www.mediawiki.org/wiki/Help:Namespaces #for more detailed explanation $wgDynamicWikiSitemapExclude=array(); $wgDynamicWikiSitemapExclude[-2]=1;# Media, links to just the image rather than the image description page $wgDynamicWikiSitemapExclude[-1]=1;# Special pages $wgDynamicWikiSitemapExclude[0]=0;# Simple page $wgDynamicWikiSitemapExclude[1]=0;# Discussion page $wgDynamicWikiSitemapExclude[2]=0;# User page $wgDynamicWikiSitemapExclude[3]=1;# User Talk page $wgDynamicWikiSitemapExclude[4]=0;# Project page $wgDynamicWikiSitemapExclude[5]=0;# Project talk page $wgDynamicWikiSitemapExclude[6]=0;# File $wgDynamicWikiSitemapExclude[7]=0;# File Talk $wgDynamicWikiSitemapExclude[8]=1;# System messages and other important content. Already Excluded. $wgDynamicWikiSitemapExclude[9]=1;# Discussions related to the associated system messages. Already Exluded. $wgDynamicWikiSitemapExclude[10]=1;# Templates $wgDynamicWikiSitemapExclude[11]=1;# Discussions related to the associated template pages $wgDynamicWikiSitemapExclude[12]=0;# Help files, instructions and 'how-to' guides $wgDynamicWikiSitemapExclude[13]=0;# Discussions related to the associated help pages $wgDynamicWikiSitemapExclude[14]=1;# Categories, dynamic lists of other pages $wgDynamicWikiSitemapExclude[15]=1;# Discussions related to the associated category pages
[edit] Setting base url other then $wgServer
- $wgDynamicWikiSitemapServerBase
- base url.
$wgDinamicWikiSitemapServerBasebase url.Deprecated as of 0.1.3 version, July 2011 use $wgDynamicWikiSitemapServerBase instead.
$wgDynamicWikiSitemapServerBase = "http://your-base-url.com"; #With that all sitemap entries get this as their base url. If not set $wgServer is used
[edit] Exclude pages from sitemap by name
- $wgDynamicWikiSitemapExcludeSites
- an array defining the excluded pages.
$wgDinamicWikiSitemapExcludeSitesan array defining the excluded pages.Deprecated as of 0.1.3 version, July 2011 use $wgDynamicWikiSitemapExcludeSites instead.
$wgDynamicWikiSitemapExcludeSites[] = 'page title to exclude'; #or $wgDynamicWikiSitemapExcludeSites = array('page1 title to exclude', 'page2 title to exclude'); #to exclude some pages from the sitemap. The pages exclude name must be equal to the name/title shown at the Special:ManualSitemap site.
[edit] Setting priority
- $wgDynamicWikiSitemapArticlePriority
- the priority scheme to use in a <priority> tag. Default is DWS_PRIORITY_CONSTANT.
$wgDinamicWikiSitemapArticlePrioritythe priority scheme to use in a <priority> tag.Deprecated as of 0.1.3 version, July 2011 use $wgDynamicWikiSitemapArticlePriority instead.
You can use following priority schemes:
-
- constant
- all priorities is 0.5 (configuration constant DWS_PRIORITY_CONSTANT);
- linear
- (configuration constant DWS_PRIORITY_LINEAR);
- quadratic
- (configuration constant DWS_PRIORITY_QUADRATIC);
- cubic
- (configuration constant DWS_PRIORITY_CUBIC);
- exponential
- (configuration constant DWS_PRIORITY_EXPONENTIAL);
- smooth
- (configuration constant DWS_PRIORITY_SMOOTH);
- random
- (configuration constant DWS_PRIORITY_RANDOM);
- reverse
- (configuration constant DWS_PRIORITY_REVERSE).
See various schemes for details.
$wgDynamicWikiSitemapArticlePriority = DWS_PRIORITY_CONSTANT;
[edit] Setting cange frequencies
- $wgDynamicWikiSitemapEstimateChangeFreq
- enable to estimate the revision frequency. Default is false.
$wgDinamicWikiSitemapEstimateChangeFreqenable to estimate the revision frequency.Deprecated as of 0.1.3 version, July 2011 use $wgDynamicWikiSitemapEstimateChangeFreq instead.
$wgDynamicWikiSitemapEstimateChangeFreq = true; # Enables to estimate the revision frequency
[edit] Setting sitemap limit
- $wgDynamicWikiSitemapLimit
- maximum number of articles at a sitemap page. Default is 10000.
$wgDinamicWikiSitemapLimitmaximum number of articles at a sitemap page.Deprecated as of 0.1.3 version, July 2011 use $wgDynamicWikiSitemapLimit instead.
Note: At exceeding the number of pages, the sitemap works at sitemap index mode.
$wgDynamicWikiSitemapLimit = 500; #The sitemap page will build with the 500 articles
[edit] Setting sorting criterion
- $wgDynamicWikiSitemapSortingCriterion
- the sorting criterion of sitemap articles. Default is DWS_SORTING_POP.
$wgDinamicWikiSitemapSortingCriterionmaximum number of articles at a sitemap page.Deprecated as of 0.1.3 version, July 2011 use $wgDynamicWikiSitemapSortingCriterion instead.
You can use following sorting schemes:
-
- popularity
- sort descending by popularity (configuration constant DWS_SORTING_POP)
- last revision
- sort descending by last revision (configuration constant DWS_SORTING_REV)
- page ID
- sort descending by page ID (configuration constant DWS_SORTING_PAGE_ID)
Note: At mode with sitemap index available only DWS_SORTING_PAGE_ID sorting scheme.
$wgDynamicWikiSitemapSortingCriterion = DWS_SORTING_POP;
[edit] Setting short URL
- $wgDynamicWikiSitemapShortUrl
- The base URL used to create sitemap page links at sitemap index mode.
Note: Requires URL Rewriting configuration.
$wgDynamicWikiSitemapShortUrl = "sitemap$1.xml";
[edit] Notes
- Code of this extension isbased on Extension:ManualSitemap extension.
- DynamicWikiSitemap works with both MySQL and INNODB installations.
[edit] See also
| Language: | English • Русский |
|---|
