Page MenuHomePhabricator

Create a parser function that allows connecting a page to Wikidata
Open, Needs TriagePublicFeature

Description

In the Wikimedia Incubator, there are test wikis for multiple projects and languages all collected in one wiki. Due to intentional design limitations in Wikidata, only one page from each wiki can be connected to an item. However, in the Wikimedia Incubator, there can be dozens of pages that would belong to the same Wikidata item, but in different languages (and/or projects). In order for pages like this to be able to benefit from Wikidata to fetch interlanguage links and data to populate infoboxes, we could have a parser function that tells the software that this page should fetch relevant data from item X.

The current situation is that the relationship only goes one way, that is Wikidata -> client wiki. This parser function would let it go the opposite way.

This would be useful for:

  • Wikimedia Incubator
  • Multilingual Wikisource
  • Beta Wikiversity
  • Possibly also other multilingual wikis that have pages in more than one language on the same topic

Other relevant bugs:
T54971: [Goal] Sitelinks and arbitrary accesses to Incubator, OldWikisource and BetaWikiversity
T206426: Storing multiple sitelinks to a multilingual wiki

I'll add a suggestion for implementation in the comments.

Event Timeline

The way I imagine this would be to have a parser function called {{#wikidata:}} (the name is obviously just a suggestion). So for any page on the Incubator that is about Norway, you would add {{#wikidata:Q20}}. The availability of this parser function should be limited to only a small number of wikis, via a configuration switch in InitialiseSettings.php, let's just call it wgAllowWikibaseAssigning, which defaults to false, but can be set to true for the relevant wikis (maybe also only allow it for a limited set of namespaces?). For enabled wikis, the parser function should do what the description says; for all other wikis, it could either just show up in plain text (like {{SHORTDESC:}} does outside of enwiki), or just not show at all, or not show, but add a tracker category. The latter would be useful for bots to connect articles to Wikidata items after a wiki has been approved and exported from the Incubator to a proper separate wiki.

I do not suggest this approach. What I suggested (since 2017) is a "virtual site" solution: You can add a sitelink to xyzwiki, which will automatically matched to (i.e. referred to) a subpage of Wp/xyz in Incubator. This also allow creating an production wiki without any change of existing sitelinks (i.e. you can switch what a sitelink refers to in configruation and all existing sitelinks will continue to work).