Template:Wikidata list

Documentation icon Template documentation[view · edit · history · purge ]
This manual might be out of date, please check with the master copy!


This template defines a bot-generated list based on Wikidata (original blog post). It must be "closed" with {{Wikidata list end}}; the text between these two templates will be periodically (once every 24h) replaced by the bot-generated list. At this moment, only one list per page is possible.

The query MUST include the ?item variable - do not rename it.


{{Wikidata list
|sparql=SELECT ?item WHERE {
   ?item wdt:P31 wd:Q39715 .
   ?item (wdt:P131)* wd:Q55 
... (This will be overwritten by ListeriaBot) ...
{{Wikidata list end}}


A SPARQL SELECT query. Needs to return ?item as the item number. Mandatory.
See SPARQL query service examples suitable for Listeria
Defines the columns of the list table. Allowed values are :
  • number, a serial row number (per section), increasing from 1, according to the initial sorting
  • label, the wiki-language-based label of the item, linked to the local article (where exists), or the Wikidata item
  • label/de, the wiki-language-based label of the item, using the given language (here, "de"), as plain text
  • description, the manual, or auto-generated description
  • item, the Q item number
  • Pxxx a Wikidata property
  • Pxxx/Pzzz, qualifier properties; for Pxxx linking to an item Qyyy and having a Pzzz qualifier, the Qxxx linked label and the value of Pzzz
  • Pxxx/Qyyy/Pzzz, qualifier properties; for Pxxx linking to an item Qyyy and having a Pzzz qualifier, the value of Pzzz. This is a version of the above, specific for a single item; e.g., "p553/q866/p554" to get YouTube account names.
  • ?fieldname, a SPARQL result field name.
Every column can optionally have a :Title, otherwise the Wikidata property name is used. Mandatory
The initial sort key for the table. Valid values are:
  • label, the label of the item
  • family_name, tries to find, and sort by, the family (last) name from the label, assuming items are people. This is a heuristic and may not work properly in all cases. If possible, try to sort by P734 (family name).
  • Pxxx, a Wikidata property
The list can be sectioned by a Wikidata property. Optional. Can be a property number (possibly prefixed by P), or a ?fieldname.
The minimum number of entries to generate a section when used together with section. All other entries will be put under section "misc". Default:2. Optional
If description is a column but no description exists on Wikidata, "autolist=fallback" uses AutoDesc to generate one. Optional
Label/description language, if different from site language. Optional
The thumbnail width for images (e.g. column P18). Default:128. Optional
How to render links not in the local Wikipedia. Valid values are:
  • all to link to Wikidata. Default.
  • local to remove entries for which there exists no local article (the opposite of red_only).
  • red to generate red links based on label and item.
  • red_only to remove entries for which there exists a local article (the opposite of local).
  • text to generate blue links for existing pages, and plain text otherwise.
  • reasonator to generate blue links for existing pages, and links to Reasonator otherwise.
Generates a template call rather than a table row; the template must then generate the table row in turn or the table header/footer need to be surpressed using skip_table parameter. Parameters passed to the template are the lower-case keys from the columns parameter, e.g. label or p18. Optional
Generates a template call rather than a table header; the template must then generate the table header. No parameters are passed to this template. Recommended to be used with row_template. Optional
Suppresses the table markup completely when using row_template. Any value will work.
Generates information that allows Wikidata editing from Wikipedia using this JavaScript. Value needs to be yes. Does not work when row_template is used. Caution: This will result in larger wikitext than normal, and updates may fail because of that. Optional
Add references. Allowed value is all. Requires {{Reflist}} or similar somewhere in the page. Optional
Numerical value X; wait at least X days before an automatic update. Does not affect updates via web interface. Optional
Comma-separated list of keys to add as a summary underneath all other content. Optional
  • itemnumber The total number of items (rows) in this list.
Any value ensures that the query is not displayed. Optional


Listeria can be combined with Template:Graph:Chart

Sample from Wikidata:Samples/charts/bar chart:

{{Wikidata list

  (wd:Q2481549 as ?item) 
  ("rect" as ?type)
  ("400" as ?width) 
  ("200" as ?height) 
  ("Number of zoos with polar bears" as ?legend) 
  ("country" as ?xAxisTitle) 
  ("zoos" as ?yAxisTitle)
  (GROUP_CONCAT(?country;separator=",") as ?x)
  (GROUP_CONCAT(?count;separator=",") as ?y)
    SELECT ?country (COUNT(DISTINCT ?zoo) as ?count)
      ?zoo wdt:P1990 wd:Q33609 . 
      ?zoo wdt:P31 wd:Q43501 .
      ?zoo wdt:P17 / wdt:P901 ?country .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    GROUP BY ?country
    ORDER BY ASC(?count) ?country


{{Wikidata list end}}

Important are "row_template", "skip_table" and the columns required by Template:Graph:Chart.

In the sample type is set to "rect". Other charts are possible (line, area, pie).

Listeria generates a single line that looks like:

| type = rect
| width = 400
| height = 200
| legend = Number of zoos with polar bears
| xaxistitle = country
| yaxistitle = zoos
| y = 23,5,4,4,3,2,2,2,2,1,1,1,1,1,1,1,1

This (or more recent data) renders as:

End of automatically generated list.