Remove a template from a category in MediaWiki

mediawiki

We use a MediaWiki at our company to host internal documentation. I created a bunch of templates that is supposed to help with organisation and identification of all the pages within the wiki.

So, for example, I made a template called wip (work in progress) that adds an appropriate banner at the top of the page notifying the reader that the page is incomplete. This template also adds the page to an unfinished category so that we can easily display all pages that are still want of completion. This way, the page author can simply use the transclude function and add {{wip}} to the top of the page to have all the magic happen.

The problem is, if I generate a list of all the pages that are listed as being incomplete, the template page also shows up on this list, because the template page itself has the [[Category:unfinished]] directive.

Is there a way to make a transcluded template add its host to a category without itself belonging to that category?

Best Answer

This sounds like a job for the <includeonly> tag. Anything in it will only be included when the template is transcluded, not on the template page itself. For your example, the template code would have this:

<includeonly>[[Category:unfinished]]</includeonly>