As the first round of building structured data content for Wikimedia Commons comes to a close, support for the Lua programming language brings structured data front-and-center to file pages.
Structured data lives behind a tab on Commons; any given file’s templates — for example, {{Information}}
, {{Artwork}}
, {{Title}}
— is where most users still get there information about a file. These templates serve different purposes; for example, {{Information}}
is primarily used for uploads of photographs that people have taken themselves. The information template is usually created during the upload process, and is stored and displayed as wikitext. Other templates, like {{Artwork}}
or {{Book}}
, exist for files that may be notable and have metadata stored on Wikidata.
What Lua does with structured data is to pull information out from behind the tab on Commons, or from Wikidata directly, and puts it into templates on the file page. The great advantage to this is that if an edit changes the data, the template will dynamically update to reflect the change. This keeps the data in sync in both how it is stored and displayed across files and sites.
Examples of templates already modified to work with Lua and structured data, courtesy of User:Jarekt:
- Module:Information: if {{Information}} is missing description field, but SDC stores captions (labels) than a SDC caption will be shown in place of description.
- Module:Artwork: if {{Artwork}} is missing Wikidata field, but structured data has digital representation of (P6243) property, than Wikidata field is set to P6243.
- Module:Title: if {{Title}} with Wikidata field can fetch titles from Wikidata. None (or very few) files have {{Title}} with Wikidata field, but if structured data has digital representation of (P6243) property, than Wikidata field is set to P6243.
User:Mike Peel has been working to build a template to pull and display structured data on the main file page as a set. {{Structured Data}}
calls other templates, description information, date, author, source, location, licensing, and other information like categories, together into one place.
Lua’s ability to pull data and present it elsewhere on Commons, whether in modules or templates, will greatly expand the reach of structured data. Using structured data makes all of these Lua modules and Lua-powered templates multilingual as well. Support for all languages is inherently provided, helping to further remove the barrier of English from Commons contributions.
Can you help us translate this article?
In order for this article to reach as many people as possible we would like your help. Can you translate this article to get the message out?
Start translation