Jump to content

Template talk:Commons-inline

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

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

[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]

Use of parameter italic

[edit]

Many thanks to User:Hike395 for adding the parameter italic to this template.

From my perspective this parameter is not re3ally intuitive as you have to put the value 1. is there no way to make this work in such a way as to just select italic in the list of used parameters and then the displayed text would be displayed in italic? Robby (talk) 18:46, 25 July 2024 (UTC)[reply]

The current template accepts any string that is related to "yes", e.g., "yes", "true", "1". This functionality is from {{Yesno}}.
To clarify, you would like |italic= (a blank parameter) to turn on italic? That's pretty non-standard: editors use blank parameters as placeholders for future use, i.e., they are as if you never used the parameter at all. Or do you mean |italic=foo for any non "no" or "false" or "0" foo would turn on the italics? — hike395 (talk) 12:35, 26 July 2024 (UTC)[reply]
Indeed I first thought that i should put the text to be displayed in italic like this |italic=text but as this did not work I imagined I should in the graphic interface just select italic and as did not work I was somewhat confused.
But after your explanations I think the implemented solution is most probably the best as indeed I was not aware of that quite a number of editors use the blank parameter as placeholder.
So just ignore my previous comment and let's continue to use the standard from the Yesno template. Robby (talk) 21:31, 26 July 2024 (UTC)[reply]
@Robby: It sounds like you're using the Visual Editor. I just added TemplateData to {{commons-inline}}: the experience will hopefully be smoother now. — hike395 (talk) 07:57, 28 July 2024 (UTC)[reply]
@Hike395: Indeed I use the Visual Editor. I checked the changes you made and it is already much more intuitive. By now ass soon as you tick the italic box the following text is displayed
whether to italicize link text
Standard: false
I suggest to add the information on how how to set to true , it could lokk like this:
whether to italicize link text
Standard: false
To change to true put: '1' respectively 'yes'
But I would like to thank you once more for having added the italic parameter.Robby (talk) 17:04, 30 July 2024 (UTC)[reply]
@Hike395: Another maybe even more intuitive solution would be to put as a Standard:Yes when using the visual Edditor and changing the displayed text in this way.
Robby (talk) 21:47, 30 July 2024 (UTC)[reply]