Wikipedia talk:Category suppression
This is the talk page for discussing improvements to the Category suppression page. |
|
This project page does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||||||||||
|
Moved from User talk:Willscrlt
[edit]Hi Willscrlt. I just stumbled on your category suppression page again. I think it is an excellent how-to guide! I am the one who created the namespace-detection templates such as {{main other}}, and I have been working with category suppression. And I have written some how-to guides here at Wikipedia. So I have some comments:
1: Your page is more than ready to be "published", so I suggest we move it to for instance Wikipedia:Category suppression. I know many users prefer fairly short page names, and we only do category suppression in templates, so naming it "Wikipedia:Category suppression in templates" is not needed. And if we ever get the magic words we have asked for to suppress categories on a page, then we should probably document their usage on the same page anyway. (When you have moved the page, then feel free to move this discussion to its talkpage.)
2: I think we should put {{how-to}}
at the top of the page, instead of {{essay}}. Since the methods you describe are good and established practice. (Perhaps due to your work?)
3: I hope you didn't mind that I fixed some things in the page? And I would like to continue editing it. I will of course discuss with you if I want to do any larger changes.
4: In section Namespace-based suppression examples you currently show "<includeonly>
" tags around each example. But that is only needed in the {{template other}} and {{namespace detect}} examples. I'd like to remove the "<includeonly>
" tags from those examples, and add some text explaining when they are needed.
5: I am currently designing (no code yet, just ideas) a template that will make category suppression very simple and mostly automatic. I'll contact you about that some day, since you seem to be our resident category suppression guru!
--David Göthberg (talk) 00:52, 13 November 2009 (UTC)
- Thanks David. Your help is greatly appreciated, and I like all of your ideas!
- 1. Done — You're looking at the new page now. I'm actually thinking that this might also make a good WikiProject (WikiProject Category suppression). If you would be interested, I will create it and get it rolling. It would be a natural tie-in with the WikiProject Templates, too, and some of its members may be willing to assist.
- 2. Done — A "How-To" it is. My first. :-) While I can't take credit for being the first to come up with some type of category suppression technique (I was actually second), I was the first to document the process and work with others to get it implemented somewhat consistently. Much better than having dozens of competing "standards".
- 3. Are you kidding? I don't mind at all! I love it that you are willing to help. The more helpful contributors the better for the project (and for my busy schedule).
- 4. That's a good point. Feel free to tweak away. It's a good idea to keep examples as simple as possible. Too complex, and we scare people away from what is really a fairly simple process (with lots of weird syntax).
- 5. I like the concept. This would be a good thing to develop within the WikiProject framework rather than here in the How-To section.
- Thanks again for your encouragement and involvement. I really appreciate it. BTW, You might want to ping me on my talk page if you comment here. I sometimes miss off-Talk discussions in my lengthy watch list, especially if it's been several days since I last logged in. —Willscrlt ( “Talk” ) 05:19, 13 November 2009 (UTC)
- 1: Nah, no need for a WikiProject. At least not until this talk page gets too crowded. We are just two editors here.
- 4: Exactly, good to see that we think the same.
- 5: It's just one template. See description in section "About ((Cat handler))" below.
- --David Göthberg (talk) 07:05, 13 November 2009 (UTC)
About ((cat handler))
[edit]This discussion has been moved to the talkpage of {{cat handler}}.
--David Göthberg (talk) 04:58, 15 November 2009 (UTC)
Oooh
[edit]Glad to see that this made it out of userspace, it is as DG says a very useful resource. Have you thought about my old comments wrt |category=
?? I still don't think it's constructive to dismiss as "not recommended" the system that is probably in use on the most pages on enwiki. Especially given that, now that this is in projectspace, that "recommendation" carries a lot more weight. Thoughts? Happy‑melon 08:44, 15 November 2009 (UTC)
- So lets pick this apart:
- 1: "
categories = no/yes
" is easy to understand, but also easy to mix up with other words such as "category =
" and "categorise =
" and so on. And the name sounds like you could use it like this: "categories = [[Category:Somecat1]][[Category:Somecat2]]
". But it works well in template coding, it can be easily forwarded to meta-templates like this: "categories = {{{categories|}}}
" - 2: "
nocat = true/false
" is somewhat less clear, the first time I saw it I had to think a little to understand if it is "true" or "false" that suppresses categorisation. But it is short and there's no risk of mixing up the name with other words. And it can be easily forwarded to meta-templates like this: "nocat = {{{nocat|}}}
" - 3: "
category = <!--Don't categorise--> / [[Category:Somecat]]
" might seem clear. But it can't be forwarded to meta-templates, since "category = {{{category|}}}
" means that the category parameter will always be defined in the meta-template, thus the meta-template can't know if the user fed an empty category parameter or no category parameter. Using "category={{{category|¬}}}
" as you do in {{WPBannerMeta}} is probably hard for the users to understand, and the current version of the docs for {{WPBannerMeta}} doesn't explain what the "¬
" is for and also shows "category={{{category|}}}
", so you guys have mixed it up yourselves. And it gets even messier when we have a template that calls a meta-template that then calls another meta-template... - 4: We have now built the automatic category suppression meta-template {{cat handler}}. That one needs both a "yes" and a "no". Or "true" and "false". Since we need a way to tell it to not categorise ("
categories = no
" or "nocat = true
"), and a way to force it to categorise on blacklisted pages ("categories = yes
" or "nocat = false
"). So using "category = <!--Nothing-->
" simply wouldn't work for {{cat handler}}. And {{cat handler}} solves pretty much all our category suppression problems, so we will probably use it a lot. - So I say it stands between "
categories = no/yes
" and "nocat = true/false
". But since "categories" have the risk of mix-up with other words, then I personally prefer "nocat = true/false
". - 5: Happy-melon: You say that "
category = <!--Nothing-->
" is the currently most used method to suppress categorisation. I don't know if that is true, but that doesn't matter. Since if a method doesn't work well, then we should start using and promoting a better method. - --David Göthberg (talk) 23:15, 15 November 2009 (UTC)
- I say it's the most widely used because it's the only method used in a top-five meta-template series (which I'd say comprised *mbox, navbox, infobox, WPBM and db-meta). As you say, that's not important in and of itself, it's just an argument that the method shouldn't just be ignored. I have grown to strongly sympathise with the coding style encouraged in MediaWiki with respect to configuration variables: double negatives are bad. Variables like
$wgDontDoSomething=true
are discouraged in favour of the less-convoluted$wgDoSomething=false
; the equivalent here is to say that I think|nocat=yes
is much less clear than a parameter like|categorise=no
.|category=something
is much clearer to me: setting the parameter to blank clearly equates to "output no categories". The method we have at WPBM to allow blank parameters to be interpreted is the only method I am aware of for doing so. The current documentation at WPBM is a result of deciding that we should stop encouraging the use of the blank parameter (see discussion); I wasn't terribly enthusiastic then, and am even less so on reflection, I think that's a step backwards for flexibility in the banner. Happy‑melon 23:52, 15 November 2009 (UTC)
- I say it's the most widely used because it's the only method used in a top-five meta-template series (which I'd say comprised *mbox, navbox, infobox, WPBM and db-meta). As you say, that's not important in and of itself, it's just an argument that the method shouldn't just be ignored. I have grown to strongly sympathise with the coding style encouraged in MediaWiki with respect to configuration variables: double negatives are bad. Variables like
- Right, double negatives is a bad thing. And that is the weakness with "
nocat = true/false/<!--Use default-->
". But as I explained above using blank values for non-default doesn't work for meta-templates. And we need all three of "yes", "no" and "use default" to cover all usage cases. So using "category = <!--No-->
" simply doesn't work. - If I were to design it without double negatives, then I would use "
categorize = yes/no/<!--Use default-->
". I am not a native English speaker, but I think "categorize" or "categorise" is better grammar than "categories". And according to my Oxford Dictionary "categorize" can be used both in the US and Britain, while "categorise" is British English. And the Google test indicates that "categorize" is way more common than "categorise". And the "z" makes it look more different to the old "categories", thus minimizing the risk of mixing them up. - However, adding a new method into the mix seems a bit much. So I still think we should use "
nocat = true/false/<!--Use default-->
", since I think that is the best of the current methods. - --David Göthberg (talk) 01:23, 16 November 2009 (UTC)
- Right, double negatives is a bad thing. And that is the weakness with "
- First, it's nice to see that my original idea (categories=no) is the preferred syntax and grammar. But, when I rewrote the original essay, I switched to nocat as my recommendation (even though I didn't like the double-negative either). What we need to decide is this... what are we enabling or disabling? Category suppression is the feature that disables the automatic categorization by well-meaning templates. In this case, we are not enabling categorization (it's a built-in part of the template). What we are enabling is essentially a demo mode that doesn't clutter up categories with nonsensical auto-cats. So, turning "on" nocat makes sense in that view. But, if automatic categorization is seen as the feature (instead of a given part of the template), then auto-cat is turned on by default, and categories=no disables that default feature. So, really, both are equally valid depending on whether categorization is seen as the feature or suppression is.
- I agree with David's 5 points. I don't think that "most used" is terribly important, especially given that it is really only 5 meta templates causing the problems. Change the 5 templates to nocat or categories, and then that becomes the most used one. Of course, any changes would have to remain backwards compatible, and that might be a little tough. I haven't actually looked at the templates' code, so I don't know if that would be an easy thing or not. But, it still seems like it is something we probably should do. —Willscrlt ( “Talk” ) 15:33, 16 November 2009 (UTC)
- Making those five meta-templates support more than one method for a while will probably be easy to code. The hard part will be to update all usage cases.
- I have just spent time documenting {{cat handler}}, and ouch, while doing so I had trouble to keep track of if I should write "
nocat = true
" or "nocat = false
" in the different examples. So I am starting to like "categorize = yes/no/<!--Use default-->
" more and more, in-spite it being a new method. And thus I also somewhat like "categories = yes/no/<!--Use default-->
". Gah! These are tough choices. - To ease the deployment of {{cat handler}} and make the transition smoother I have made it so that it understands both "nocat" and "categories". I will describe how to use that in its documentation.
But adding support for "category" doesn't seem possible, since I looked around and it is used in all kinds of strange ways. - --David Göthberg (talk) 18:35, 16 November 2009 (UTC)
- Oh dear, I have spent the evening investigating how the "category" parameter is used in different places. I know this discussion isn't about {{cat handler}}, but about what methods to recommend in this how-to guide. But I think that trying to comply with those methods in {{cat handler}} is a good test to see if a method is usable or not. So here goes:
- If {{cat handler}} should be backwards compatible with the "category" parameter then here are the rules it needs to obey:
- If "
category =
" (empty but defined) or if "category = no
", then this template does not categorize. - If "
category =
" (not defined) or if "category = ¬
", then this template categorizes as usual. - If "
category = yes
" this template categorizes even when on blacklisted pages.
- If "
- It is possible to add that to the code in {{cat handler}}, but it would be very messy code. Also, any template built with {{cat handler}} then must forward "category" like this:
category = {{{category|¬}}}
Trying to explain in the documentation why "¬" must be used would be hard...And I am a very experienced template programmer, still it took me more than one day to figure out how to use "category" in a meta-template. So I say "category" should be avoided.- --David Göthberg (talk) 03:41, 17 November 2009 (UTC)
- Call me crazy, but I added support for the "
category =
" parameter in {{cat handler}}. I hope I have understood correctly how the "category" parameter is supposed to be used... It did cause messy code in {{cat handler}}, and it bloated the documentation. But it will make it much easier to transition between the different suppression methods. And I of course still think we should transition away from "category=
" to instead use "categories=no
" or "nocat=true
". - --David Göthberg (talk) 21:52, 18 November 2009 (UTC)
- The schema in the documentation is correct. Sorry I don't have time for a fuller response. Happy‑melon 23:55, 19 November 2009 (UTC)
- However, you've placed the default in a different place; currently the result of
|category=cheesecake
is to cause category suppression, while this template (AFAICT) leaves categories enabled. Happy‑melon 08:26, 21 November 2009 (UTC)
- Call me crazy, but I added support for the "
- Now that is cheesy. Reacting on invalid input? Why do your templates do that? And do other templates that use "category=" work the same? I know some use it to also feed categories. As far as I remember some of them then suppress the default categories and instead render whatever input they get. While some render both the default categories and the extra category fed. I'll have to look around again to see what usage is out there. But my hunch is that there is no sane way we can directly support all variants, since some contradict each other. Well, we could have "category2=" and "category3=", each representing a different behaviour...
- By the way, since you seem to be into undefined variables, take a look at the brand new {{ifparadef full}}, it can help other templates detect undefined variables, and it doesn't need the "¬" so no character is reserved!
- --David Göthberg (talk) 10:06, 21 November 2009 (UTC)
Switch
[edit]In Wikipedia:Category_suppression#Namespace-based_suppression_examples there is the following example:
Finally, if automatic categorization/suppression is desired in multiple namespaces or if you need different categories to be used in different namespaces, use the powerful {{Namespace detect}}
template:
etc.
I would have used the parser function "switch" for this. Something like:
Finally, if automatic categorization/suppression is desired in multiple namespaces or if you need different categories to be used in different namespaces, use the powerful "switch" parser function:
{{#switch:{{NAMESPACE}} | =''Article category'' |Talk=''Talk category'' |Template=''Template category'' |#default=''All others''}}
And add tags if template category should exclude the template itself. Debresser (talk) 16:32, 16 November 2009 (UTC)
<noinclude>...</noinclude>
- That should be
<includeonly>...</includeonly>
tags. (I too mix them up all the time.) And we do have them in the example, just that we have them outside of the entire example. For clarity we could perhaps move them in to the "template =
" line. We also explain when and why one should use those tags in a section further up. - Yes, directly using a switch-case is in a sense more powerful. But we usually don't keep different talk spaces apart. Your switch case only handles the article "Talk:" space. While {{namespace detect}} uses "
talk =
" to mean all talk spaces. Also, {{namespace detect}} has the "demospace" and "page" parameters, that make it easy to test the behaviour of a template that uses it. By the way, for some cases {{namespace detect showall}} is better to use than {{namespace detect}}. - But we will probably deploy {{cat handler}} pretty soon, then both the switch-case and {{namespace detect}} will seem like Stone Age methods.
- --David Göthberg (talk) 17:34, 16 November 2009 (UTC)
- Obvious I meant the includeonly tags. Worse, that's what I really meant, just that my fingers were making their own job of it. :) You are of course correct that {{Namespace detect}} and "switch" refer to a different "talk". I had a cursory look at {{Cat handler}}, but didn't have that intuitive flash of understanding that sometimes accompanies a template, like I had when seeing the "switch" parser function. Then again, some people still don't feel they have anything to work with computers... Debresser (talk) 22:24, 16 November 2009 (UTC)
- Yeah, switch-cases are very nice tools.
- The tricky part with {{cat handler}} is that the really interesting parts of it are the parts that aren't visible: That when used with its default settings it doesn't categorize in the namespaces where we usually have a problem with auto-categorization, and that it has a blacklist. Since all you see when looking at it might be as little as "
{{cat handler|[[Category:Somecat]]}}
", still it sees to that templates don't auto-categorize in the wrong places. I'll try to add this in the lead section of cat handler's documentation. - --David Göthberg (talk) 22:55, 16 November 2009 (UTC)
- So since this is a legitimate and powerful tool for category suppressing, it should be in the article, along with the others. That was my point. Debresser (talk) 10:02, 17 November 2009 (UTC)
- Yes I agree, using ParserFunctions directly is a legitimate and powerful tool. If you can make a short and clear example of using ParserFunctions such as switch-cases, then yeah, it would probably be nice in this how-to guide. Another option would be to make a subpage with advanced techniques and linking to it prominently in some places in the guide. In such a subpage we could go into much more detail and have several complex examples. How about calling it Wikipedia:Category suppression/examples? But keep in mind, using ParserFunctions directly often means that people badly mess up their category suppression.
- --David Göthberg (talk) 18:15, 17 November 2009 (UTC)
Question Regarding Category Suppression
[edit]Hello, first I would like to say excuse me if I am posting this in the wrong place.
I am an administrator over at the Wizard 101 Wiki and I have a small question about category suppression. I am working on a simple infobox that auto populates categories. However I want to be able to suppress certain categories if one of the parameters is filled in as "No". I am still slightly new at creating Info boxes and I searched the Internet for a few hours now trying to figure out how I can accomplish this. If someone could please point me to a page that explains how to use category suppression inside of an Info box then I would be most appreciative.
Thank you for taking the time to help.
I will be checking this page for a response or you could leave a message on my talk page located here. One again, thanks.
Wizard101Admin (talk) 08:54, 7 August 2010 (UTC)
nocat=true? is bad
[edit]So using nocat=true
is preferred? I say: never ever use a negative question. It is a mental tripline (and non-intuitive at best). It is legalanguge too, or do not you think that it can not be excluded that it is not so? Better is: showcat=true
. -DePiep (talk) 22:20, 21 July 2012 (UTC)
- For those templates that can categorize the page on which they are used (e.g. userbox templates) the normal situation (i.e. on hundreds of user pages) is that the template should categorize. It's only in unusual cases that the categorization needs to be suppressed. Thus (in most/all cases) the default should be not to suppress the categorization. DexDor (talk) 22:15, 27 January 2016 (UTC)
Outdated
[edit]The normal approach for suppressing categories in templates is now to add a 'demo' parameter. This needs to be covered in this howto. John Vandenberg (chat) 01:34, 25 January 2014 (UTC)
- John, that's not a method I've seen used much (if at all) - can you provide an example of such a template? Afaics most/all of the CATSUP page is still correct so I'm not sure it really needs an 'outdated' warning on it. DexDor (talk) 22:20, 27 January 2016 (UTC)
- See Template:Userspace linking templates wikitext. The page is looking better now after [1]. John Vandenberg (chat) 23:50, 27 January 2016 (UTC)
- But those templates don't normally categorize anyway (afaics, they only categorize if misused) and few/none of them mention a "demo" parameter in their documentation. If I was showing an example of how to use such a template I'd use (for example) {{User|Jimbo Wales}} (Jimbo Wales (talk · contribs)) (which needs no category suppression) rather than {{User|}} (which would categorize) or {{User||demo=yes}}. I've tried looking into these templates, but they are nested many times and Template:Userlinks (for example) makes no mention of a "demo" parameter - how's it supposed to work? (for example, why does {{User||demo=no}} not suppress the category?). In other words, I think "demo" needs a better explanation and example of use before being added to this page. DexDor (talk) 05:26, 29 January 2016 (UTC)
- See Template:Userspace linking templates wikitext. The page is looking better now after [1]. John Vandenberg (chat) 23:50, 27 January 2016 (UTC)
Help page is better?
[edit]Shouldn't this be a help page, i.e. in the namespace "Help", instead of "Wikipedia"?--Ideophagous (talk) 13:57, 4 May 2022 (UTC)