Wikibase/Extending/en

Wikibase is a powerful and extensible piece of software, and a large amount of what it can do lies beyond the fairly stripped-down state Wikibase is in when you run your Docker images for the first time.

On this page you can take a quick, link-heavy tour of the resources available to help you extend your instance and give it the functionality you want and need it to have.

Templates
MediaWiki templates work a bit like text macros in that they contain content meant to be transcluded into other wiki pages. But their functionality can extend far beyond simple text replacement when scripting comes into play (see calling Lua modules).

To view the templates installed on your (or any) instance, navigate to.

While there is no single repository for MediaWiki templates, Wikipedia does offer a robust template resource page. You can find them easily by searching the web or by looking through what’s installed on any given instance of MediaWiki. When you find a template you want to use, follow these instructions to start using it on your instance.

Simple templates
A few templates that Wikibase users often find useful:


 * SPARQL - SPARQL query syntax highlighting
 * Q - creates a direct link to an item
 * Property - displays a localized label for a property

You can also check out this helpful third-party overview of templates: ryadel.com

Powerful templates
Templates can call modules written in the Lua scripting language, making them more powerful.


 * Scribunto - enables the embedding of scripting languages into MediaWiki, currently only Lua. This enables, among other powerful applications for scripting, the use of Lua modules in templates (see above).
 * - Lua tutorial for MW/Scribunto
 * - Detailed references for Lua in MW/Scribunto, and the Wikibase-specific Lua API and JSON format
 * - Differences from standard Lua

Primer to MediaWiki extensions
MediaWiki’s robust software ecosystem offers a wide range of extensions, pieces of code that modify how your installation looks and works. Extensions come in many shapes and sizes, from simple and useful tweaks to large modifications in functionality; as you probably know, Wikibase is itself an extension to MediaWiki. You can browse and download many of these extensions with the MediaWiki ExtensionDistributor. These install instructions should cover most cases, but some extensions have special instructions called out separately below.

To view the extensions you currently have installed, navigate to.

Extensions to Wikibase
This section gives an overview over the available MediaWiki extensions that can extend Wikibase. See also.

Data quality
The following extensions help you manage the quality of your Wikibase data.


 * A powerful extension that helps you impose constraints on your properties (which are actually more like guidelines) to improve the quality of your Wikibase data. See also the constraints portal which offers many constraints-oriented resources and tips on how to implement them effectively.
 * A powerful extension that helps you impose constraints on your properties (which are actually more like guidelines) to improve the quality of your Wikibase data. See also the constraints portal which offers many constraints-oriented resources and tips on how to implement them effectively.


 * Allows storing Shape Expressions Schemas on wiki pages (using ShExC syntax), as well as validating entities against those Schemas using the ShEx2 — Simple Online Validator.
 * Allows storing Shape Expressions Schemas on wiki pages (using ShExC syntax), as well as validating entities against those Schemas using the ShEx2 — Simple Online Validator.

More data types
See and.

Importing data
See.

Other extensions

 * Adds useful auto-suggestion of properties for manual edits.
 * Adds useful auto-suggestion of properties for manual edits.

Gadgets
Gadgets are small interface modifications that each user of an instance can choose to activate or deactivate for their own use. The extension enables the use of gadgets (see below). You may well find that this extension is already installed on your instance, but make sure: it needs to be installed and enabled before implementing anything listed in the next section!

Some examples can be found in the and Wikidata’s installed gadgets. Here’s a guide to, and here’s how to.

General utility

 * - expands the search form with many additional options
 * - offers an optional rich-text editor (see also the project page)

Content management and spam protection

 * Abuse Filter &mdash; create filters for editing to forestall abusive activity
 * Nuke &mdash; enable mass deletion of pages
 * Confirm Edit &mdash; add CAPTCHA checks before an edit is confirmed
 * Tor Block &mdash; restrict access for Tor exit nodes

Wikibase-specific

 * OAuth &mdash; implements OAuth, required for some tools to work correctly with Wikibase
 * CLDR &mdash; contains and manages locale-specific information regarding the display of data in different languages and formats
 * Universal Language Selector &mdash; allows users to configure an interface language of their choice

Other additions
As if templates, extensions and gadgets weren’t enough, there are many other ways you can customize your Wikibase installation. Here are some of the most commonly used.

Interface messages
As an administrator (with editInterface permissions), you can customize the messages displayed to the user by Wikibase. A complete list of them can be found on the Special:AllMessages page of your instance:

Consult the System message documentation for more information.

Sitelinks
Sitelinks allow Wikibase’s MediaWiki interface to link to other wikis in a more useful way than a simple hyperlink. A good example is the language selector on Wikipedia pages; it relies on sitelinks established to wikis in other languages.

Although the Docker images handle most of the config changes shown in the Wikibase install documentation, sitelinks are a notable exception.

To get sitelinks working, first work through the sitelinks section of the install doc. Then consult the sites table for further guidance.

Sorted properties and statements
By default, Wikibase displays content from queries and on entity/item pages in the order in which each item was added to the database. To make a change in the display order, you’ll need to use a sorted properties list.

Learn more about it on the Sorted Properties page, and check out Wikidata’s own Sorted Properties for inspiration.

Pywikibot
For more advanced users who seek tools to help them manage their data, there’s Pywikibot. It started life as a tool made for Wikipedia but was adapted to work on other Wikimedia projects, including Wikibase installations. Pywikibot amounts to a collection of scripts that can change and manipulate data programmatically, potentially saving large amounts of manual work.

Check out the third-party wiki quick start for Pywikibot to see if it might be right for your installation.