Topic on Project:Support desk

Block category from template on certain pages?

3
104.175.80.121 (talkcontribs)

I am working on a wiki which includes some cleanup templates that automatically categorize paces they are added to. For example, a {{cleanup}} might contain <includeonly>[[Category:Cleanup needed]]</includeonly>

I want to also be able to demonstrate some of those templates on a help page. However, adding the templates to the help page then adds the help page to the "Cleanup needed" category. Is there any way to prevent a template from adding a category to a specific page?

104.175.80.121 (talkcontribs)

Sigh. "paces" should read pages. I don't see a way to edit the body.

Clump (talkcontribs)

Well, you could test for an argument to see if you should include the category, so your {{cleanup}} looks something like <includeonly>{{#ifeq:{{{cat|yes}}}|yes|[[Category:Cleanup needed]]}}</includeonly>, and your use of it in your help page is {{cleanup|cat=no}}.

Alternatively, to avoid the need to pass in a specific argument in the invocation, you could test for specific pages to not categorize: <includeonly>{{#switch:{{PAGENAME}}|Ignore This Page|Ignore This One Too|Help Page=|#default=[[Category:Cleanup needed]]}}</includeonly>

Reply to "Block category from template on certain pages?"