Difference between revisions of "Template:Category"

From Hitchwiki
Jump to navigation Jump to search
 
Line 22: Line 22:
 
-->{{#if: {{{1|}}} | {{#ifexist: Category:{{{1}}} | [[Category:{{{1}}}]] }} }} }} }} }} }}<!--
 
-->{{#if: {{{1|}}} | {{#ifexist: Category:{{{1}}} | [[Category:{{{1}}}]] }} }} }} }} }} }}<!--
 
--></includeonly>
 
--></includeonly>
 +
 +
<noinclude>
 +
[[Category:Templates]]
 +
</noinclude>

Latest revision as of 22:50, 22 March 2025

Where 2 is a subcategory of 1. In general, this kind of categorization doesn't make sense.

This template helps with page categorizing. It's intented for use especially in other templates. Takes max. 5 parameters and starts to check category existence from the last one, only the last existing category is used as a result.

Examples

{{Category|Europe|Germany|Bavaria|nonexistentcategory}}
--> [[Category:Bavaria]]

{{Category|Germany|Bavaria}}
--> [[Category:Bavaria]]

{{Category|Canada|Quebec|Montérégie}}
--> [[Category:Quebec]]

Note

Tthis template doesn't check if a category is under another category, picture is only informal. Therefore it's good to use for geo/administrative categories. Don't use it to put page in more categories e.g. {{Category|Poland|Slovakia|Border crossings}}.