Template:Category handler/doc

This is the category handler meta-template. This helps other templates to automate both categorization and category suppression.

Already when used with its default settings this template prevents auto-categorization in some namespaces and on some pages where we usually don't want categorization. Thus even the most basic usage like " " sees to it that templates don't auto-categorize in the wrong places.


 * This template makes it easy to choose in what namespaces a template should and should not categorize.
 * It makes it easy to use different categories in different namespaces.
 * This template also uses a central blacklist where we can add pages and page types where templates should not auto-categorize.

When not to use this template

 * If a template only needs to categorize in one of the namespaces main (articles), file (images) or category, then using this template is overkill.
 * If your template needs to categorize in any other namespace, then we recommend you use this template, since it provides proper category suppression and makes it easy to select how to categorize in the different namespaces.

Namespaces
This template detects and groups all the different namespaces. These types are used as parameter names in this template.


 * main = Main/article space, as in normal MediaWiki.org articles.
 * talk = Any talk space, such as page names that start with "Talk:", "User talk:", "File talk:" and so on.
 * user, project, file, mediawiki, template, help, category and book = The other namespaces except the talk pages.
 * other = Any namespaces that were not specified as a parameter to the template.

Basic usage
This template takes two or more parameters. Here's an example with the full template code for an article message box:

The above example uses the default settings for category handler. That means the box will categorize on pages in the following namespaces:
 * main, file, help, category, portal and book

But it will not categorize in the following namespaces:
 * talk, user, project, mediawiki and template

And it will not categorize on blacklisted pages. (See section blacklist below.)

The reason this template does not categorize in some of the namespaces is that in those namespaces most templates are just demonstrated or listed, not used. Thus most templates should not categorize in those namespaces.

Any template that is meant for one or more of the namespaces where this template categorizes can use the basic syntax as shown above.

Blacklist
This template has a blacklist of the pages and page types where templates should not auto-categorize. Thus templates that use this meta-template will for instance not categorize on /archive pages and on the subpages of template messages.

If you want a template to categorize on a blacklisted page, then feed " " to the template when you place it on the page, thus skipping the blacklist check. Note that this template only categorizes if it has data for the namespace. For instance, if the basic syntax is used (see basic usage above), then even if you set " " the template will not categorize on a talk page, since it has no data for talk pages. But it has data for help space, so on a blacklisted help page it will categorize.

The blacklist is in the sub-template category handler/blacklist. To see or update the blacklist, go there.