Lua support for Structured Data on Commons – pulling data into templates

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:

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.

Archive notice: This is an archived post from Wikimedia Space, which operated under different editorial and content guidelines than Diff.