Template talk:Commons-inline

Latest comment: 1 year ago by Palosirkka in topic | short =

Documentation edit

Usage edit

{{Commons-inline|Wikisource work}}

This template creates an inline link to the Wikicommons in list format.

Examples edit

Normal edit

{{Commons-inline|Work}}

  Media related to Work at Wikimedia Commons

Text override edit

{{Commons-inline|Work|Puffle}}

  Media related to Puffle at Wikimedia Commons

Full link override edit

{{Commons-inline|links=[[commons:Foo|]] and [[commons:Bar|]]}}

  Media related to Foo and Bar at Wikimedia Commons

List format edit

{{Commons-inline|list=
** [[commons:Foo|]]
** [[commons:Bar|]]
}}

  Related media at Wikimedia Commons:

Improving the "no parameter" case edit

Right now, when this template is called with no parameters, it defaults to using the title of the page as a search at Commons. The old behavior of search at Commons would take the reader directly to a gallery or category if the search string matched the name. However, in the last year or so, the search has become more conservative, and our readers are taken to a crowded and possibly confusing search results page.

Instead, I propose that we use Wikidata to restore the old behavior for no parameters, when possible. The code in the sandbox does this. When there are no parameters, it calls Module:Commons link to first look for a Commons gallery associated with the article. If no such gallery is found, it looks for Commons category associated with the article. If neither is found, then it defaults back to the current behavior of searching Commons with the article title.

A few things to note about Module:Commons link:

  • It has been used at {{commons and category}} and {{commons and category-inline}} for a month now, with no complaints or negative feedback.
  • There are multiple entries in Wikidata that represent associated Commons galleries or categories. Module:Commons link checks all of them, and only uses them if they all agree. Otherwise, it defaults back to the current search behavior. This will protect against vandalism and false positives. If there is any inconsistency, the Lua code places the article in one of two tracking categories: 1 or 2, so we can fix it.

Note that this change only affects the "no parameter" case (see test cases). All other behaviors remain the same:

  • If a single parameter is provided, the link is directly to that page in Commons
  • The second parameter is still used as linktext.
  • The named arguments still work as before: |short=, |list=, |links=, |extratext=.

Any questions or comments before I turn this on? — hike395 (talk) 06:45, 16 March 2020 (UTC)Reply

| short = edit

What's that? --Palosirkka (talk) 10:09, 21 June 2022 (UTC)Reply