Jump to content

Module:Pagetype/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 12:34, 25 October 2013 (add mainspace classes). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

This module is used to detect the page type of a given page. It detects redirect pages automatically and is highly customisable. It can be used on its own or as a meta-module to create other page-type-detection templates.

Basic usage

For simple detection of the page type of the current page, use the default settings:

{{#invoke:pagetype|main}}

That will produce the following results:

Page type / namespace Output
Redirects (in any namespace) redirect
Main namespace article
File namespace file
Template namespace template
Category namespace category
Module namespace module
Book namespace book
Other namespaces page

If the module is used on a talk page, it will detect the page type for the corresponding subject page.

Main namespace classes

For pages in the main namespace, it is possible to add a class value in the first positional parameter:

{{#invoke:pagetype|main|class}}

If the class value matches one of the values in the table below, it will produce an alternative to the default output of article.

Class Class values Output
Disambiguation page disambiguation, disambig, disamb, dab page
No applicable class na, n/a page

You can input the class value in any combination of upper and lower case.

Custom main namespace classes

It is also possible to produce custom output for the main namespace classes:

{{#invoke:pagetype|main|class|dab=yes|na=yes}}
{{#invoke:pagetype|main|class|dab=custom name|na=custom name}}

This works the same way that it does for the custom namespace page types. Possible parameters are:

  • dab: a custom value for disambiguation-class pages. If set to "yes", "y", "true" or "1", this produces "disambiguation page". If set to "no", "n", "false" or "0", no custom value is produced. If set to any other value it produces that text.
  • na: a custom value for NA-class pages. It works in the same way as the dab parameter. The default value for "yes" etc. is "page".