Jump to content

Learning patterns/Using Wikidata on Wikipedia infoboxes

From Meta, a Wikimedia project coordination wiki
A learning pattern forwiki design
Using Wikidata on Wikipedia infoboxes
problemHow can I enable Wikidata for an infobox on my language's Wikipedia without writing all the Lua scripts from scratch?
solutionCopy the solution of small language editions of Wikipedia and work with the people who wrote them.
creatorDeryck Chan
created on15:38, 23 August 2017 (UTC)

What problem does this solve?[edit]

The functionality to use Wikidata's properties and statements data in other Wikimedia projects was first made possible about three years ago. The first working prototypes for Wikipedia was publicized at Wikimania last year. Since then, there has been a proliferation of tools written to put information from Wikidata into other Wikimedia projects, particularly infoboxes.

The challenge is that Wikidata phase 2 made available a bunch of Lua methods and a few parser functions to fetch Wikidata, but no central repository of relevant Lua scripts or centralized guidance on how to use Wikidata. Therefore, many scripts and templates were independently developed on many different WMF wikis. These scripts and templates have overlapping functionality but are generally incompatible with one another because they were created by volunteers who are unaware of each other's work.

This problem is complicated by the fact that the English and German Wikipedias, which many smaller wikis learn from, have highly entrenched and bespoke methods of storing data using wikitext. Both projects have conservative practices and are very adverse to big changes like switching to Wikidata. Smaller wikis would benefit greatly from Wikidata but don't have any major projects to learn from.

In the run-up to Wikimania 2017, several contributors have independently proposed conference sessions to discuss the automatic use of Wikidata in Wikipedias. Four competing "trunk" projects of Lua scripts to Wikidata are identified and many good practice recommendations were presented. A panel discussion was held and the content presented at this session is indexed at wm2017:Wikidata and infoboxes.

What is the solution?[edit]

The general idea is to start working in a topic area without an existing template, so the use of Wikidata would not cause conflict with other people. The following recommendations emerged from the panel discussion at Wikimania.

  • Learn from another small wiki. Small wikis have a greater need for automated infoboxes and would have developed simpler tools to use them.
  • Talk to the authors of those tools and ask them to help you get started with yours.
  • Start with a topic where there is a need for an infobox but there isn't one yet.
  • Use parser functions {{#property}} or {{#statement}} where they're adequate because this avoids the need for local Lua scripts
  • If more complicated tools are needed, try w:ca:Module:Wikidata, w:en:Module:Wikidata or w:fr:Module:Wikidata for existing modules to copy (these are all different from each other).

Things to consider[edit]

  • You may need to copy a lot of data to Wikidata from various Wikipedias in order to make your Wikidata-powered infobox useful. But this is worth doing because you are saving future editors' work!
  • MediaWiki support for Wikidata is in ongoing development. {{#statement}} was released recently (deployed 2016-17) and more native tools are on their way.
  • Wikidata itself is in continuous development. Things like date formatting, which currently requires sophisticated Lua scripts to do, may become native Wikidata features soon.

When to use[edit]

  • Use whenever you want to create a new infobox from now on.
  • Don't bother converting existing templates that are maintained by other people just yet. Volunteer time is better spent putting data into pages that don't have infoboxes yet.


  • This advance is important one for small to medium Wikipedias which are willing to take data from Wikidata. Technical people should come together for an universal solution and take load off users from smaller communities. Papuass (talk) 19:56, 28 September 2017 (UTC)[reply]

See also[edit]

Related patterns[edit]

External links[edit]