Template talk:Category ifexist

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
WikiProject iconCategories
WikiProject iconThis template is within the scope of WikiProject Categories, a collaborative effort to improve the coverage of categories on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.

Else condition[edit]

I think an else condition would be useful in this template, trivial to implement but I will give it a few days on this abandoned talk page before adding it. --Trialpears (talk) 20:45, 20 April 2021 (UTC)[reply]

@Trialpears: A late reply. I was also thinking about adding an else or more, specifically alternative categories to add if the first category doesn't exist. The second unnamed parameter is optionalsortkey. If the third is used as an else then I fear many users will forget the sortkey and try to use the second as the else so I suggest a named parameter |alt= for the name of an alternative category. If the alternative also doesn't exist then don't add it but instead add a new maintenance category Category:Pages using Template:Category ifexist with non-existing alt category. The name is similar to others at Special:PrefixIndex/Category:Pages using Template:. I suggest two alternatives can be added at the same time with |alt2= for the second. It could be useful for cases where an intersection category may or may not exist or be created in the future, e.g. {{Category ifexist|Kickboxers from Oregon|alt=American kickboxers|alt2=Sportspeople from Oregon}}. Both alt and alt2 should be added if they exist. If any of them doesn't exist then add the error category with "alt" in the name regardless of which one doesn't exist. I don't anticipate a significant need for an else part which is not a category but we could allow it with an additional parameter like |else= where any text is allowed. PrimeHunter (talk) 01:05, 23 March 2023 (UTC)[reply]