手册:$wgContentNamespaces

From mediawiki.org
This page is a translated version of the page Manual:$wgContentNamespaces and the translation is 94% complete.
命名空间: $wgContentNamespaces
被认为包含真内容或文章的命名空间。
引进版本:1.7.0 (r14738)
移除版本:仍在使用
允许的值:(命名空间索引的数组)
默认值:[ NS_MAIN ]

详情

$wgContentNamespaces的存在是为了允许自定义命名空间被认作包含有用的内容,以满足以下特性:

Extension:Popups, Special:Random, Special:Statistics, Special:AncientPages, Special:DeadendPages, Special:FewestRevisions, Special:LonelyPages, Special:MostCategories, Special:MostInterwikis, Special:RandomPage, Special:ShortPages, Special:LongPages, Special:UncategorizedPages, Special:WithoutInterwiki, {{NUMBEROFARTICLES}}, Notifications[1]

如果新加的命名空间也包含“内容”,并且这个内容应该可以被随机页面抽中,或者在计算维基内文章总数时被计入,这个变量是很有用的。 它也作为$wgExemptFromUserRobotsControl 的默认,也就是说__NOINDEX__和__NOFOLLOW__魔术字不会在变量中的命名空间中起作用。

主命名空间,以及被引用的该数组内的其他命名空间,都被认为是内容名字空间。

示例:

$wgContentNamespaces = [ 0, 12, 112 ];

$wgContentNamespaces = [ NS_MAIN, NS_HELP, NS_PROJECT, NS_CUSTOMNAMESPACE ];
如果你改变这个变量,你得运行updateArticleCount.php 以更新Special:Statistics中的计数以及{{NUMBEROFARTICLES}}。

并不控制全文搜索引擎默认搜索的命名空间;那得单独用$wgNamespacesToBeSearchedDefault 配置。

The set of content namespaces for a wiki can be retrieved via the siteinfo API endpoint, e.g. action=query&meta=siteinfo&siprop=namespaces, and filter for namespaces with "content": true.

参见

  1. Page link notifications work for content namespace pages