Manual:Article count

The article count is the number of content pages on a wiki. It is available from the wiki's 1>Special:Statistics|Special:Statistics page, from the   mw>Special:MyLanguage/Help:Magic words|magic word, and through a "" query via the 3>Special:MyLanguage/API:Main page|MediaWiki API.

By default, a page is counted as an article when:


 * 1) it's in the main 1>Special:MyLanguage/Help:Namespace|namespace (meaning its title doesn't have a prefix like "User:" or "Talk:"),


 * 1) it contains at least one 1>Special:MyLanguage/Help:Links#Internal links|internal wikilink (e.g. the text " Main Page " creates a wikilink to the page titled "Main Page"), and


 * 1) it isn't a 1>Special:MyLanguage/Manual:Redirects|redirect.

The first criterion can be expanded to consider other namespaces through the use of the  variable. (Note that some <tvar|1></> do this when they are installed.)

The second criterion can be overridden if the <tvar|1></> variable is set to the value "any", in which case all non-redirects in content namespaces are counted as articles. However, when the value "link" is used — which is the default as defined in <tvar|1></> — only pages containing a wikilink are considered. This includes both stubs and disambiguation pages, provided they contain links.

There is no way to change the third criterion. Redirects are never counted as articles.

Changing the MediaWiki article count settings
Initially MediaWiki counted a page as an article if it contained at least one comma. That method proved to be unreliable in many languages where the comma does not have much or any significance. (See 1>m:Special:MyLanguage/Article count reform</>|Article count reform for the process which led to this outcome.)

Before <tvar|118></>, the method used to count articles was determined by the configuration variable <tvar|UseCommaCount></>, which was at the same time deprecated and ultimately removed in <tvar|124></>.

Since 1.18, the variable <tvar|ArticleCountMethod></> has been used.

While article counting based on commas is still relatively common in the wiki world (see, e.g., BiggestWiki), the ability for MediaWiki to do this was completely removed in.

In recent versions of MediaWiki, the existence of links is checked by consulting the <tvar|1></> database table, so it includes links provided by the transclusion of templates or other pages. Special links such as category links (which place pages into categories) and file links (which display files) do not count when determining the article status of a page, because those links affect different database tables.

To change to a different method, use one of the following approaches:

MW 1.18 and after

 * Define the article count method with the variable <tvar|1></>.

MW 1.17 and before

 * If you want to count articles only if they contain a comma, you can set the variable <tvar|1></> to <tvar|2> </> in <tvar|3></>.

Updating article count statistics
Following a change in article count method you will almost certainly want to recount your wiki to reflect that change (this does not happen automatically). To do so, run <tvar|1></> from the command line.

If you only have access to the database, you can get an approximation to the article count by using a query similar to the following, which only checks page links (similar to the "link" method) in the main namespace: