User:Michael Große (WMDE)/WikibaseSiteLinksDoku
The following text is a draft for explaining how to enable sitelinks on 3rd party Wikibase installations. It is to be inserted as another
h2 on Wikibase/Installation.
Sitelinks are special links that contain a site and a title, and go from individual Items to pages on other wikis. In Wikidata these go to other Wikimedia sites such as Wikipedia, Wikisource and Wikivoyage. Among other things, Sitelinks are used to allow referencing a property of the Item on the linked page in the client wiki, a feature that is called Direct access.
First, you need to think about how to group the client-wikis you want to see in your sitelinks area on the Items in your repo-wiki.
Define custom groups
In your repo-wiki, replace the content of
LocalSettings.php with the groups you would like to see there.
For example, consider the following line being added to
$wgWBRepoSettings['siteLinkGroups'] = [ 'wikipedia', 'mywikigroup', 'anothergroup' ];
This will allow three groups in the SiteLinks box on the Item's page:
- the standard defined
wikipediafor the global Wikipedia sites
- two custom wikis groups – here named
anothergroupjust for example
The names defined here will be relevant to the
site_group field in the
sites table as specified below.
If you do not want your installation to make use of sitelinks at all, then you can deactivate that feature by setting the configuration to an empty array:
$wgWBRepoSettings['siteLinkGroups'] = ;
2. Localize your own groups
To show the correct heading for your own groups, you have to create the page
MediaWiki:Wikibase-sitelinks-mywikigroup with the desired heading as text.
You can create subpages to set the heading in different languages, e.g.
MediaWiki:Wikibase-sitelinks-mywikigroup/de to create the German heading.
3. Add the Wikis to the sites table
To be able to add sitelinks to Items in your repo-wiki, you need add the client-wikis to the sites table. Take care that the group name used there must be one of the group names you added above. Following the example above, for instance, there would be one or more sites with
anothergroup as text in the
Please also note that you need to set both the file path and the page path, and they do need to include the
$1 placeholder. For further details on how to add sites to the table, please see these specific instructions.
After any modification made to Mediawiki's
sites table, you should rebuild Wikibase's
wb_items_per_site table. To do that, run the following command from your repo-wiki root directory:
- Go to
Special:SetSiteLinkin your repo-wiki and try to link an existing Item (field "ID") to one of the above configured sites (field "Site ID") by providing an existing page on that wiki (field "Sitelink"). It should either work or give you a useful error message.
- On the page you added above, check that Direct access works by referencing a property of the Item in a parser function