**Main components:**
* Wikimedia Badges
**Problem:**
The sidebar link to Wikimedia Commons on various Wikipedias currently uses `P373` ("commons category"). It would be better to use the interwiki sitelinks to Commons instead.
This is one of the blockers for the eventual deletion of `P373` ("commons category") from Wikidata - see the ongoing discussion at https://www.wikidata.org/wiki/Wikidata:Properties_for_deletion#Property:P373
**Solution:**
To use the interwiki sitelinks to Commons the logic would be:
1) If there is a sitelink to Commons in the attached Wikidata item, use that (optional: unless it is to a gallery page)
2) If there is a `P910` ("topic's main category") value, follow that to the category item and use the sitelink to Commons from there
3) If there is a `P1754` ("category related to list") value, follow that to the category item and use the sitelink to Commons from there
4) If there is a `P373` ("commons category") value use this as a last fallback
5) Otherwise, display nothing.
This follows the logic of the "_getCommonslink" function of https://commons.wikimedia.org/wiki/Module:WikidataIB - which is used to display the links in https://en.wikipedia.org/wiki/Template:Commons_category .
**Notes:**
* As this is specific code used for the Wikimedia projects only, it should probably sit in the Wikimedia Badges extension, like the current `P373` code (see T94989).
* The exact logic for getting “the” `P910`/`P1754` value is the same as in the current `P373` code (first string-valued best-rank statement).
**Acceptance criteria:**
[] This works as described (see "solution").
[] This needs to be able to cope with P373 being deleted without breaking things (and ideally it should be easy to remove the P373 fallback in that case).
**Open questions:**
* Should we include P373 as a last fallback (before it is removed)?
**Community communication:**
* Announce to the community in our wiki summary while we work on it.
* Announce on project chat / let Mike announce.