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  on Wikibase/Installation.

Enable Sitelinks
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.

1. Configure your sitelink groups
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  in   with the groups you would like to see there.

For example, consider the following line being added to :

This will allow three groups in the SiteLinks box on the Item's page:
 * the standard defined  for the global Wikipedia sites
 * two custom wikis groups – here named  and   just for example

The names defined here will be relevant to the  field in the   table as specified below.

Deactivate the sitelinks feature
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:

2. Localize your own groups
To show the correct heading for your own groups, you have to create the page with the desired heading as text.

You can create subpages to set the heading in different languages, e.g.  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  and   as text in the   field.

Please also note that you need to set both the file path and the page path, and they do need to include the  placeholder. For further details on how to add sites to the table, please see these specific instructions.

After any modification made to Mediawiki's  table, you should rebuild Wikibase's   table. To do that, run the following command from your repo-wiki root directory:

4. Verify that you can add sitelinks

 * 1) Go to   in 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.
 * 2) On the page you added above, check that Direct access works by referencing a property of the Item in a parser function