Template:Navigation by/Wikidata/doc

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

A metatemplate for category navigation boxes populated from Wikidata

Usage

{{Navigation by/Wikidata |name= |title= |above= |below= |1, 2, 3...= |item= |property= |level= |sort= |pattern= |the= |redlinks= |style= }}

The template Navigation by/Wikidata 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.

This template is used by the Navigation by/criterion family of metatemplates, which in turn serve as a basis for the Navigation by criterion family of navigation boxes as well as for the navigation part of the {{Category description}} boxes. Do not use this template directly, but rather use one of those derived templates instead.

The only occasion where you should actually use this template directly is when you create a new metatemplate of the form Navigation by/criterion, providing navigation by a previously unsupported criterion:

Creating a new metatemplate

A category navigational metatemplate can either be static (meaning that there is a fixed list of navigation items) or dynamic (meaning that the navigation items are determined from Wikidata).

Static metatemplates

To create a new static metatemplate, you create a new template following the naming scheme Navigation by/criterion with the following content:

<includeonly><onlyinclude>{{Navigation by/Wikidata
 | name = {{subst:PAGENAME}}
 | title = Wikidata ID of title item
 | above = {{{above|}}}
 | below = {{{below|}}}
 | 1 = Wikidata ID of first navigation item
 | 2 = Wikidata ID of second navigation item
 | 3 = Wikidata ID of third navigation item, etc.
 | sort = label (only if you want the items to be alphabetically sorted)
 | pattern = {{{pattern|<<criterion>>}}}
 | the = {{{the|}}}
 | redlinks = {{{redlinks|yes}}}
 | style = {{{style|box}}}
}}</onlyinclude></includeonly>{{Documentation|content={{Navigation by/metatemplatedoc}}}}

[[Category:Category navigational metatemplates|Criterion]]

See {{Navigation by/month}} for an example for a static metatemplate.

Dynamic metatemplates

To create a new dynamic metatemplate, you create a new template following the naming scheme Navigation by/criterion with the following content:

<includeonly><onlyinclude>{{Navigation by/Wikidata
 | name = {{subst:PAGENAME}}
 | above = {{{above|}}}
 | below = {{{below|}}}
 | item = {{{item|}}}
 | property = Wikidata property ID to use for compiling the navigation list
 | level = {{{level|}}}
 | sort = label (only if you want the items to be alphabetically sorted)
 | pattern = {{{pattern|<<criterion>>}}}
 | the = {{{the|}}}
 | redlinks = {{{redlinks|yes}}}
 | style = {{{style|box}}}
}}</onlyinclude></includeonly>{{Documentation|content={{Navigation by/metatemplatedoc}}}}

[[Category:Category navigational metatemplates|Criterion]]

See {{Navigation by/administrative division}} for an example for a dynamic metatemplate.

Template parameters

ParameterDescriptionDefaultStatus
nameName of the template. Only used for the “box” style.
When defining a new metatemplate, use {{subst:PAGENAME}}.
emptyrequired
titleWikidata item ID to build the title of the navigation box. If not set, it will be determined automatically from the “item”, “property”, and “level” parameters, thus it is required if these three parameters are not set. Not used for the “list” style.emptyoptional
aboveText to output above the actual navigation list. Only used for the “box” style.
When defining a new metatemplate, use {{{above|}}} to allow the calling template to define this.
emptyoptional
belowText to output below the actual navigation list. Only used for the “box” style.
When defining a new metatemplate, use {{{below|}}} to allow the calling template to define this.
emptyoptional
1, 2, 3...Wikidata item IDs of the navigation items in static metatemplates.emptyoptional
itemWikidata item ID to use as a starting point for the list of navigation items in dynamic metatemplates.
When defining a new dynamic metatemplate, use {{{item|}}} to allow the calling template to define this.
emptyoptional
propertyWikidata property ID to use for the list of navigation items in dynamic metatemplates.emptyoptional
levelWikidata level to get the navigation items from:
children
the list will be composed directly from the item's property
siblings
the parent of the item will be determined, and the list will be composed from that parent's property

For the “block” style, this parameter can be left blank, which results in both levels being generated in the order “siblings” - “children”.

When defining a new dynamic metatemplate, use {{{level|}}} to allow the calling template to define this.
emptyoptional
sortsort criterion:
label
sort the list of navigation items by alphabet
If that parameter is left blank, navigation items generated from unnamed or numbered parameters will remain in the order in which they appear in the argument list, and navigation items generated from the item/property/level parameters will remain in the order in which the values appear in the Wikidata statement list.
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 metatemplate, use {{{pattern|<<criterion>>}}} to allow the calling template to define this and set the default to the actual Commons categories.
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 metatemplate, use {{{the|}}} to allow the calling template 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 metatemplate, use {{{redlinks|yes}}} to allow the calling template 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
block
used in {{Category description}} templates
When defining a new metatemplate, use {{{style|box}}} to allow the calling template 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:

Example

{{Navigation by/Wikidata|title=Q24384|Q1311|Q1312|Q1313|Q1314|pattern=<<season>> in Europe}}
{{Navigation by/Wikidata|item=Q30|property=P150|level=children|sort=label|pattern=Mountains of <<state>>|the=yes|redlinks=yes}}

renders as:

See also