Forum:Tip: Licensing template with content category

Related wiki: The Sims Wiki.

Not a help request, just a tip for fellow editors. You can have users add a category to an uploaded image automatically through the license dropdown menu. This works by editing MediaWiki:Licenses (only for admins). You can create a new template for each license and category combination, but the smartest thing would probably be to add a parameter to the license template. Parameters for license templates can be added to MediaWiki:Licenses by using the. An entry in the MW page might look like this: **License pd|parameter|This file is Public Domain The parameter then triggers a #switch in the  template and assigns the appropriate category.


 * Examples
 * The Sims Wiki - MediaWiki:Licenses
 * The Sims Wiki - Template:Copyright by EA

This little trick really helps uploaders to categorize their images as this is often forgotten (since MyHome doesn't list edits in the File: namespace, and uploading images through the gallery interface ignored the licensing dropdown menu completely)

Ilovefoxes initially told me about it on the Doom wiki. My thanks to them.

On a related note, is there somewhere that you can share tips and tricks like these other than this forum? Also minor tips & tricks like hiding the article name at the top of pages and similar stuff. At first I was thinking help.wikia or Wikia Open Source, but I don't think they're quite right for it.

Duskey ( talk ) 09:59, August 28, 2010 (UTC)


 * Why are parameters needed to that template? Wouldn't be more easy to create different templates for each license instead of having one for all? --Ciencia Al Poder (talk) -WikiDex 11:42, August 28, 2010 (UTC)
 * If the only difference is the category, then there's no need to duplicated the license every time; and it is simpler to add a new entry to the dropdown if no other changes are required.
 * That said, the license template is coded somewhat disingenuously; it would be simpler if the parameter was the category instead of a codeword; then you'd not need to chenge the license for each addition at all, and could forgo the switch statement. Everytime you update that template, it places a lot of load on your wiki because all images pages get re-computed.
 * So use

**License template|category|description
 * in your MediaWiki:Licenses, and use


 * in your license template. -- ◄mendel► 12:01, August 28, 2010 (UTC)