Edge Rewrite
// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a4417bd79d2b11f8

Jump to content

Template talk:Commons category

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 1 month ago by Hike395 in topic Convert template to Lua?

See also Wikipedia:Sister projects

|italics=no not working

[edit]

For example... RodRabelo7 (talk) 04:39, 26 April 2024 (UTC)Reply

https://en.wikipedia.org/w/index.php?title=Template:Commons_category/doc&diff=prev&oldid=1220828596
I think I fixed it. Regards, RodRabelo7 (talk) 04:40, 26 April 2024 (UTC)Reply

Extra space when the template is floated to the left

[edit]

Greetings and felicitations. In Mavai_Senathirajah#External_links I am seeing extra space below the template when it is floated left that is not there when it is on the right. Would someone please be so kind as to fix this? —DocWatson42 (talk) 22:50, 5 February 2025 (UTC)Reply

Have you tried to remove the blank line between this template and the subsequent navboxes? (And why isn't {{Commons category-inline}} a better option?) -- Michael Bednarek (talk) 02:35, 6 February 2025 (UTC)Reply

Automating lowercasing of first letter for common nouns

[edit]

Despite the |lcfirst=yes option, many instances of this template that could be lowercased have capitalized first letters. I wonder if it'd be possible to automatically detect this, perhaps by referencing Wikidata labels (which tend to be lowercase for common nouns) or something else. Sdkb talk 21:43, 23 August 2025 (UTC)Reply

Are there examples of what should be lowercased and what shouldn't? 174.138.218.72 (talk) 18:23, 24 August 2025 (UTC)Reply
The template output is formulated as a sentence so I guess Sdkb wants lowercase for everything which would normally be lowercase in a sentence, for example changing Lakes to lakes when commons:Category:Lakes is linked. The template documentation doesn't say when to use lcfirst. I thought it was only meant for lowercase Commons categories like commons:Category:eBay. Lakes is in italics and is the only linked term so it stands out, and the link goes to a page saying Lakes. My interpretation is that "Lakes" isn't merely a word in a sentence but a reference to the category and should use uppercase when the category does. PrimeHunter (talk) 19:37, 24 August 2025 (UTC)Reply
Ah, we should indeed resolve that usage question first. (The first step is finding whoever added that parameter without usage documentation and trouting them for it...)
In the example that led me here, White chocolate#See also, because it's two words, it would've looked a little weird to capitalize the first but not the second. Your perspective also makes sense, PrimeHunter, although the more I think about it, the more the italics seem weird. Since the wording of the template is "related to", and the images at Commons are related to the concept the article is about. Sdkb talk 19:58, 24 August 2025 (UTC)Reply
There would be no discussion if it very directly referred to the category name with something like "Wikimedia Commons has related media in the category Lakes." But it says "Wikimedia Commons has media related to Lakes." The category reference is more indirect but I still think, especially with the italics which wouldn't be used in a normal sentence, that it should follow the category name. Also for commons:Category:White chocolate. With lowercase, a reader might think that lakes or white chocolocate is an article link and they should click the Commons icon for the media. That's another issue: I think we should delink the icon like {{Sister project links}}. PrimeHunter (talk) 20:42, 24 August 2025 (UTC)Reply
Nobody thinks this. Andy Dingley (talk) 21:20, 24 August 2025 (UTC)Reply
The delinking icons question looks like it involves more complexity than you'd initially think; I've taken it up here. Cheers, Sdkb talk 01:42, 25 August 2025 (UTC)Reply
Another possibility is to extend the link to the text "media related to white chocolate". Clicking the link takes the reader to some media, not to some chocolate nor an article about chocolate. Certes (talk) 10:45, 25 August 2025 (UTC)Reply
That's an excellent solution to the MOS:EGG issue. Sdkb talk 17:38, 25 August 2025 (UTC)Reply

Convert template to Lua?

[edit]

I propose that this template use the same Lua implementation (Module:Commons link) that other Commons templates (e.g., {{Commons}}, {{Commons category-inline}}, {{Commons-inline}}) have had for years. This will simplify maintenance and reduce the computational burden of rendering pages. The Lua version of the template is implemented at {{Commons category/sandbox}}.

The Lua code already uses the same tracking categories as this template. The logic to select the Commons page is almost the same: there is one minor difference in the Wikidata logic. Multiple Wikidata fields (Commons sitelink, P910, P1754, and P373) are searched for the Commons category. In the current template, the first field that contains an entry is used. In the Lua version, if there is any contradiction between the fields, the article is placed into a tracking category and Commons search is used instead. This more conservative logic has been in place for years on hundreds of thousands of pages.

Any comments or questions on the proposal? — hike395 (talk) 19:03, 4 August 2026 (UTC)Reply

 Implemented Hearing no objection, I went ahead and converted the template. Please let me know if you see anything anomalous. — hike395 (talk) 13:35, 11 August 2026 (UTC)Reply