The sidebar link to Wikimedia Commons on various Wikipedias currently uses `P373`. It would be better to use the interwiki sitelinks to Commons instead. The logic in this case 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` value, follow that to the category item and use the sitelink to Commons from there
3) If there is a `P1754` value, follow that to the category item and use the sitelink to Commons from there
4) 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 .
This is one of the blockers for the eventual deletion of `P373` from Wikidata - see the ongoing discussion at https://www.wikidata.org/wiki/Wikidata:Properties_for_deletion#Property:P373