Template talk:Category ifexist

Else condition
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)
 * 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  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   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.  . Both   and   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   where any text is allowed. PrimeHunter (talk) 01:05, 23 March 2023 (UTC)