4

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?

  • 1
    Welcome to Web Applications! Your question seems to be on topic here, so I edited out the introductory sentence. – Vidar S. Ramdal Nov 17 '15 at 11:59
3

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.