Manual:GenerateSitemap.php/zh

详情
generateSitemap.php文件是一个维护脚本，用于为一个安装好的MediaWiki生成sitemap. Sitemap是一个用于让搜索引擎爬虫（如Google爬虫）更有效率地索引一个网站的文件（前提是爬虫支持sitemap协议）.

本脚本会默认生成一个sitemap索引文件，以及一个包含所有有内容的命名空间的通过gzip压缩后的sitemap. 在#Options节查看可以被传递给本脚本的选项.

此外，你可能会需要创建一个定时任务来自动更新sitemap.

如果你还需要MediaWiki的维护脚本的通用介绍，你可以在这里查看更多：.

选项
 
 * 显示可以用于 的选项

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

 
 * What site identifier to use for the wiki, defaults to

 
 * 指向 的URL，例如
 * 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   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.

 
 * If this option is added redirects are skipped and thus not listed within the sitemap. This is recommended since Google can complain about redirects. However the default setting is not to skip redirects.

例子
为Google站长工具创建网站地图：

首先（在$IP中，就是文档根目录，这是您的“LocalSettings.php”文件所在位置）：

然后：

This example assumes that  is set to. Non-latin domains need use Punycode.

Related configuration parameters

 *  : 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.