Difference between revisions of "Template:GameCategory"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Fix examples)
(Add Category sorting key)
Line 1: Line 1:
 
<includeonly>{{#if:{{{1|}}}
 
<includeonly>{{#if:{{{1|}}}
 
|{{#if:{{{2|}}}
 
|{{#if:{{{2|}}}
|[[Category: {{Name|{{{1}}}|short}}: {{{2}}}]]
+
|[[Category: {{Name|{{{1}}}|short}}: {{{2}}}|{{#replace:{{uc:{{{FULLPAGENAME}}}}}|{{uc:{{{{{Name|{{{1}}}|short}}}}}}}:|}}]]
|[[Category: {{Name|{{{1}}}|short}}]]]]}}
+
|[[Category: {{Name|{{{1}}}|short}}]]|{{#replace:{{uc:{{{FULLPAGENAME}}}}}|{{uc:{{{{{Name|{{{1}}}|short}}}}}}}:|}}]]
 +
}}
 
}}</includeonly><noinclude>
 
}}</includeonly><noinclude>
Adds a game (sub-)category to the proper format.
+
Adds a game (sub-)category to the proper format and finds the page Category Sort key (e.g <tt>Arma 2: Editing</tt> gets sorted as <tt>EDITING</tt>).
  
 
== Usage ==
 
== Usage ==
Line 20: Line 21:
 
|-
 
|-
 
| <nowiki>{{GameCategory|arma}}</nowiki>
 
| <nowiki>{{GameCategory|arma}}</nowiki>
| <tt><nowiki>[[Category: {{Name|arma}}]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|arma}}]]</tt>
+
| <tt><nowiki>[[Category: {{Name|arma}}|SORTKEY]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|arma}}|SORTKEY]]</tt>
 
|-
 
|-
 
| <nowiki>{{GameCategory|arma3|Editing}}</nowiki>
 
| <nowiki>{{GameCategory|arma3|Editing}}</nowiki>
| <tt><nowiki>[[Category: {{Name|arma3}}: Editing]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|arma3}}: Editing]]</tt>
+
| <tt><nowiki>[[Category: {{Name|arma3}}: Editing|SORTKEY]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|arma3}}: Editing|SORTKEY]]</tt>
 
|}
 
|}
  
 
[[Category:Templates|{{uc:{{PAGENAME}}}}]]
 
[[Category:Templates|{{uc:{{PAGENAME}}}}]]
 
</noinclude>
 
</noinclude>

Revision as of 15:34, 26 July 2020

Adds a game (sub-)category to the proper format and finds the page Category Sort key (e.g Arma 2: Editing gets sorted as EDITING).

Usage

{{GameCategory|game|subCategory}}

  • game: game id, see {{Name}}
  • subCategory: (Optional, default empty) sub-category (e.g Editing)
Examples
Code Result
{{GameCategory}} N/A
{{GameCategory|arma}} [[Category: {{Name|arma}}|SORTKEY]]
End result: [[Category: Arma|SORTKEY]]
{{GameCategory|arma3|Editing}} [[Category: {{Name|arma3}}: Editing|SORTKEY]]
End result: [[Category: Arma 3: Editing|SORTKEY]]