Module talk:Wikidata

From Wikivoyage
Latest comment: 5 years ago by ARR8 in topic Single value
Jump to navigation Jump to search

getSiteLink for Commons[edit]

What is the syntax to get the Commons page of the article? Like {{#invoke:Wikidata|getSiteLink|enwikivoyage}}, I see enwiki and enwikiquote but what is the code for Commons page? --Traveler100 (talk) 16:39, 20 January 2018 (UTC)Reply

Was informed by someone at Wikipedia, is commonswiki . --Traveler100 (talk) 17:08, 20 January 2018 (UTC)Reply

get site link from qid (i.e. not current page)[edit]

Would like to get the wikipedia page of another page that the current wikivoyage page. However what works on wikipedia does not work here. For example: {{#invoke:Wikidata|getSiteLink|enwiki|qid=Q327162}}. Is there another method or can this module be updated? --Traveler100 (talk) 13:11, 11 November 2018 (UTC)Reply

The code for getSiteLink was different at en.wikipedia, so I've copied over the version from wikipedia and tested and it's working now. Example: European route E40 -- WOSlinker (talk) 13:37, 11 November 2018 (UTC)Reply
great, thanks.--Traveler100 (talk) 14:04, 11 November 2018 (UTC)Reply

Single value[edit]

Would like to get one (the best) image from wikidata P18. With {{#invoke:Wikidata|getValueFromID|Q1223508 |P18|FETCH_WIKIDATA}} I get multiple values.

  • Ohrid from Samuel's Fortress 2.jpg

is there another option or a different module command that just returns one image file name?--Traveler100 (talk) 11:02, 15 January 2019 (UTC)Reply

Module:WikidataIB works better for this, with its maxvals parameter.
{{#invoke:WikidataIB|getValue|P18|fwd=ALL|osd=no|noicon=true|qid=Q1223508|maxvals=1}}
Ohrid from Samuel's Fortress 2.jpg
ARR8 (talk | contribs) 14:04, 15 January 2019 (UTC)Reply