Jump to content

Template talk:Category see also if exists

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.
[edit]

@BrownHairedGirl: I have added a fallback category link.

However, you might have had better ideas in mind, e.g. linking to multiple categories if they exist.

So far I have only used the fallback category in Template:Namibia 1910s estab by year. In that instance I could easily replace it with a hard-coded alternative ifexist test, which IIRC we did include in one of the standard establishment nav templates. – Fayenatic London 11:56, 1 October 2018 (UTC)[reply]

@Fayenatic london: Thanks for the ping. I don't recall whether I had considered a development of this template.
Having considered it now, I think that a multiple cat development of the original would be more in keeping with Template:Category see also, which supports multiple categories: output any of the list which exists. So {{Category see also if exists|Africa|Affrica|Africkerr|Europe|Yurp|Youroop}} would produce Africa Europe
However, what you have made here is a genuinely useful idea which I suggest deserves a template of its own. I would suggest allowing multiple fallbacks so that the output is the first on the list which exists, or nothing if all are non-existent. The names I can come up with so far for such a template are a bit verbose "Category see also if exists with fallback", "Category see also first which exists" etc. The latter feels better, but maybe "Category see also if exists 2" would be simplest? --BrownHairedGirl (talk) • (contribs) 19:57, 1 October 2018 (UTC)[reply]
The original doc page did mention "(Hope to add the possibility for more category names)". Clearly it hasn't been a priority, but I agree that both development options could be useful.
I also agree with moving the fallback version to a different name. For brevity I like the suggestion "Category see also if exists 2". The suffix "2" might imply some parallel function with {{LinkCatIfExists2}}, so I considered adding parallel functionality to that template, but it's not wanted there – {{LinkCatIfExists2}} already has a fallback outcome to show the same text, in grey, for the same target category but unlinked. Never mind; numerical suffixes have no consistency of function when used elsewhere, e.g. see Template:Hatnote templates. Let's go for it. – Fayenatic London 09:03, 2 October 2018 (UTC)[reply]
@Fayenatic london:. Sounds good to me. Go for it! --BrownHairedGirl (talk) • (contribs) 14:17, 2 October 2018 (UTC)[reply]
Done, see Template:Category see also if exists 2. I have reverted my changes on this template, and will leave its future development to you. – Fayenatic London 21:24, 2 October 2018 (UTC)[reply]
Many thanks, @Fayenatic london.
Thanks to your prompting the discussion, this template now supports multiple categories as parameters, by using the newly-created Module:Category see also if exists.
It would be very easy to adapt it for Template:Category see also if exists 2, so that that template would display the first extant category of a list. So for example you could have {{Category see also if exists 2|MyHouse|MyStreet|MyVillage|My sub-district|My district|My region|My state|Russia}}
If you like, I could make a sandbox version for your inspection. --BrownHairedGirl (talk) • (contribs) 20:03, 3 October 2018 (UTC)[reply]
Well done on this template, and thanks very much for the offer, BrownHairedGirl. I've posted your offer on its talk page in case any other editors would find that useful.
At present I'm thinking of something else! I would be more interested in both templates testing whether the page that exists is a category redirect, and linking to the redirect target instead of the redirect. Would that be hard? – Fayenatic London 20:49, 3 October 2018 (UTC)[reply]
@BrownHairedGirl: please note that there is currently a Lua error shown on template pages Template:Russia 1720s estab by year & the corresponding disestab template – but not on the pages where they are transcluded, so it doesn't appear to matter. (I could hide the errors using "includeonly" tags, but I don't see the point in that.) – Fayenatic London 22:13, 3 October 2018 (UTC)[reply]
@Fayenatic london: many thanks for spotting that. There was a possible error which I hadn't considered and hadn't checked for. Now fixed.[1] --BrownHairedGirl (talk) • (contribs) 00:48, 4 October 2018 (UTC)[reply]