Template:Navigation by/doc

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

A family of metatemplates for category navigation boxes populated from Wikidata

Usage

{{Navigation by
 |1 =
 |above =
 |below =
 |item =
 |pattern =
 |the =
 |redlinks =
 |style =
}}

The template family Navigation by facilitates the creation of category navigation boxes which are populated from Wikidata. The text displayed in the resulting navigation boxes will be derived from Wikidata labels in the user's language, so they will be fully translated into all languages available in Wikidata. At the same time, output is formatted using the standard Navbox module, which means that the navigation boxes are nestable and consistent in design.

The family consists of:

  1. a number of metatemplates for various criteria used to build navigation lists
  2. this template which is used as a wrapper around 1. to create the actual navigation templates, and
  3. all the actual navigation templates built with 1. and 2.

It is not recommended to use this template directly in a category page for navigation. Instead, you can use one of the actual templates derived from this one, or you can build a new navigation template as described below.

Available criteria

criterion metatemplate variant Wikidata property actual templates
administrative division dynamic P150 list
month static - {{Navigation by months}}
season static - {{Navigation by seasons}}

If you want to add more criteria, please see the documentation of {{Navigation by/Wikidata}}.

Creating a new navigation template

From a static metatemplate

To create a new navigation template from a static metatemplate, you create a new template following the naming scheme Navigation by criterions with the following content:

<includeonly><onlyinclude>{{Navigation by|criterion
 | above = Additional text to be displayed above the navigation list (optional)
 | below = Additional text to be displayed below the navigation list (optional)
 | pattern = {{{pattern|<<criterion>>}}}
 | the = {{{the|}}}
 | redlinks = {{{redlinks|yes}}}
 | style = {{{style|box}}}
}}</onlyinclude></includeonly>{{Documentation|content={{Navigation by/templatedoc|variable=criterion|pattern=example pattern}}}}

[[Category:Category navigational templates|Criterion]]
[[Category:Internationalised navigational templates|Criterion]]
[[Category:Criterion|~Navigation]]

See {{Navigation by months}} for an example of a navigation template built from a static metatemplate.

Please note that for each static metatemplate, usually there exists exactly one actual navigation template.

From a dynamic metatemplate

To create a new navigation template from a dynamic metatemplate, you create a new template following the naming scheme Navigation by criterions with the following content:

<includeonly><onlyinclude>{{Navigation by|criterion
 | above = Additional text to be displayed above the navigation list (optional)
 | below = Additional text to be displayed below the navigation list (optional)
 | item = Wikidata item ID to use for compiling the navigation list
 | pattern = {{{pattern|<<refined criterion>>}}}
 | the = {{{the|}}}
 | redlinks = {{{redlinks|yes}}}
 | style = {{{style|box}}}
}}</onlyinclude></includeonly>{{Documentation|content={{Navigation by/templatedoc|variable=refined criterion|pattern=example pattern}}}}

[[Category:Category navigational templates|Refined criterion]]
[[Category:Internationalised navigational templates|Refined criterion]]
[[Category:Refined criterion|~Navigation]]

See {{Navigation by states of Austria}} for an example of a navigation template built from a dynamic metatemplate.

For each dynamic metatemplate, many different actual navigation templates can be built.

Template parameters

ParameterDescriptionDefaultStatus
1Criterion for navigation, i.e. metatemplate to useemptyrequired
aboveText to output above the actual navigation list. Only used for the “box” style.emptyoptional
belowText to output below the actual navigation list. Only used for the “box” style.emptyoptional
itemWikidata item ID to use as the starting point for the list of navigation items when using a dynamic metatemplate.emptyoptional
patternName pattern for the links to which the navigation items will point. Any variable enclosed in “<<” and “>>” will be replaced by the correct link target.
When defining a new template, use {{{pattern|}}} to allow the caller to define this.
emptyrequired
theIf this parameter is not blank, the name of some items (as defined in Module:Navigation by Wikidata/special rules) will be prefixed with a "the".
When defining a new template, use {{{the|}}} to allow the caller to define this, unless you know none of the navigation items will ever require a “the” prefix.
emptyoptional
redlinksIf this parameter is not blank, red links (links to nonexisting category pages) will be included, if it is blank, they will be excluded.
When defining a new template, use {{{redlinks|yes}}} to allow the caller to define this and default to “yes”.
emptyoptional
styledisplay style of the navigation list:
box
standalone navigation box
inline
a borderless navigation box which can be embedded in a table
list
just the item list to embed it into a Navbox with several navigations
When defining a new template, use {{{style|box}}} to allow the caller to define this and default to “box”.
boxoptional

Additional information

The template is intended to be used in the following namespaces: the Template namespace

The template is intended to be used by the following user groups: all users

Relies on:

See also