Extension:UnlinkedWikibase
UnlinkedWikibase Release status: beta |
|
---|---|
Implementation | Parser function |
Description | Access to Wikibase entities from wikis that are not linked to a Wikibase site. |
Author(s) | Sam Wilson (Samwilsontalk) |
Latest version | 3.1.3 (2024-05-25) |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | >= 1.38 |
Database changes | No |
Composer | samwilson/unlinked-wikibase |
License | GNU General Public License 2.0 or later |
Download | |
Help | Help:Extension:UnlinkedWikibase |
|
|
Quarterly downloads | 14 (Ranked 119th) |
Translate the UnlinkedWikibase extension if it is available at translatewiki.net | |
Vagrant role | unlinkedwikibase |
Issues | Open tasks · Report a bug |
The UnlinkedWikibase extension provides access to Wikibase entities from wikis that are not linked to a Wikibase site. For example, a private wiki with a page about Goats could retrieve metadata from the Wikidata item goat (Q2934) and display it in an infobox. See the help page for more information about using it.
Installation
[edit]- Download and move the extracted
UnlinkedWikibase
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/UnlinkedWikibase - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'UnlinkedWikibase' );
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Upgrading
[edit]Breaking change: When upgrading from 2.0 to 3.0, note that mw.ext.UnlinkedWikibase.getEntity()
has changed to return 1-index arrays rather than 0-indexed as previously. For example, the value of the first title (P1476) claim should be found with item.claims.P1476[1].mainsnak.datavalue.value.text
rather than item.claims.P1476[0].mainsnak.datavalue.value.text
.
Configuration
[edit]URLs and caching
[edit]To link to a different Wikibase other than Wikidata, set the following two configuration variables:
$wgUnlinkedWikibaseBaseUrl = 'https://xxx.wikibase.cloud/wiki/';
$wgUnlinkedWikibaseBaseQueryEndpoint = 'https://xxx.wikibase.cloud/query/sparql';
Entities and queries are cached for 1 and 60 minutes respectively. These can be changed as follows:
$wgUnlinkedWikibaseQueryTTL = 3600;
$wgUnlinkedWikibaseEntityTTL = 60;
Note that $wgUnlinkedWikibaseEntityTTL
can be set to null
if you wish to use the maintenance script to refresh the cache (see below for details).
Parser function
[edit]To enable an experimental {{#statements:}}
parser function that operations similarly to the Wikibase parser function of the same name, add the following to LocalSettings.php:
$wgUnlinkedWikibaseStatementsParserFunc = true;
Note that this is experimental and may require changes to make it compatible with the new parser (e.g. requiring the |from=
parameter).
Interlanguage links
[edit]It is possible to set a page's interlanguage links based on the sitelinks defined in its Wikibase item, using the Sitelink Suffix configuration variable. This should be set to the wiki family suffix (for example, wiki
for Wikipedia or wikisource
for Wikisource, when using Wikidata).
$wgUnlinkedWikibaseSitelinkSuffix = 'wiki';
Set it to false
(the default) to disable this feature.
If your wiki has its own sibling wikis in other languages, and you want to keep these as being able to be set in the normal way, add their language codes to $wgUnlinkedWikibaseSitelinkSkippedLangs
. For example, if you have two wikis, in Indonesian and French, then pages can link to these with e.g. [[fr:Lorem]]
, and they should be excluded from UnlinkedWikibase's handling:
$wgUnlinkedWikibaseSitelinkSkippedLangs = [ 'fr', 'id' ];
This relies on the Wikibase site IDs being the concatenation of their language code and family name; if this is not true for your set-up please open a task on Phabricator.
Maintenance script
[edit]There is a maintenance script that can be used to update the cached Wikibase entity data. It's of most use if you set $wgUnlinkedWikibaseEntityTTL = null
, which will prevent the external requests from being run (other than the first time).
Run it as follows:
$ php ./maintenance/run UnlinkedWikibase:UpdateEntities
See also
[edit]This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |
- Beta status extensions
- Parser function extensions
- Extensions supporting Composer
- GPL licensed extensions
- Extensions in Wikimedia version control
- InfoAction extensions
- OutputPageParserOutput extensions
- ParserFirstCallInit extensions
- ScribuntoExternalLibraries extensions
- SidebarBeforeOutput extensions
- All extensions
- Extensions included in Miraheze
- Extensions included in WikiForge
- Wikibase extensions