Template:Databox/doc
Jump to navigation
Jump to search
This is a documentation subpage for Template:Databox. It contains usage information, categories, and other content that is not part of the original template page. |
Uses Lua: |
This module provides an as simple as possible infobox system based on Wikidata.
It is fully automated, does not require any configuration to be used and does not have any declination based on the type of entity (person, place...).
How does it work?
This module is the backend code of the Databox template.
It uses the Wikidata item linked to the current page or the item which id is filled into the item
parameter to automatically build an infobox.
Its basic algorithm is:
- Use the label of the item or, if none exists, the title of the page for the infobox title.
- Use the value of image (P18) for the main image.
- Use the value(s) of instance of (P31) for the data table title.
- Take all the properties used by the item, sort them according to MediaWiki:Wikibase-SortedProperties, and for each one:
- If the property has the datatype External identifier, Commons media file or Quantity[a 1], do not display anything.
- If the property is in the
property_blacklist
array of the module, do not display anything (it is done in order to filter properties not very relevant for displaying in infoboxes). - If the property has more than 5 values do not display anything (to avoid long lists in the infobox).
- Use default Wikibase rendering system to display the values that have the "best" rank (i.e. the values with the rank "preferred", if some exists, and, if not, the ones with the rank "normal").
- If there is value for coordinate location (P625), then display a map using Kartographer.
Notes
- ↑ The current display of quantities by Wikibase is very limited, this filter should be removed after improvements
How to use it in your wiki?
- Copy the code of
Module:Databox
in a module page in your wiki namedModule:Databox
. - Add the created module page to the sitelinks of Q53931871.
- Create
Template:Databox
in your wiki with the wikitext:{{#invoke:Databox|databox}}
. - Add the created template page to the sitelinks of Q20702632.
- At this point if you add
{{Databox}}
to an existing article connected to a Wikidata item it should work. - Write an help page in your language
Examples
Early Modern Swedish
Lucy |
Ethanol |
Hubble Space Telescope
|
4 Vesta
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Iron Man
|
Airbus Commercial Aircraft
|
Esperanto
|
Berlin
|
Douglas Adams
|
See also
- ru:Template:Универсальная карточка - similar, but more developed template in Russian Wikipedia
- en:Template:Infobox person/Wikidata - similar, for people only, in English Wikipedia
- commons:Template:Wikidata Infobox - Commons' equivalent; mostly used for categories