Jump to content

Category talk:Templates that support category suppression

Page contents not supported in other languages.
Add topic
From Wikiquote

How to make a template that supports category suppression

[edit]

Templates that support category suppression use the |categories=no parameter, as described at Category:Templates that support category suppression. Templates that add a page to a category, without adding the template itself to the category, use code like this (where "Example" is the category name):

<includeonly>[[Category:Example|{{PAGENAME}}]]</includeonly>

To add the |categories=no feature to a template, just replace the above code with this new conditional code (just add the code shown in bold):

<includeonly>{{#ifeq:{{{categories}}}|no||[[Category:Example|{{PAGENAME}}]]}}</includeonly>
  • Note the double closing brace ( }} ) — the template will break if you leave this out.

When this feature is added to a template, please add the template itself to Category:Templates that support category suppression, removing it from Category:Templates that add pages to categories if applicable. (The former is a subcategory of the latter.)

For additional technical information see w:User:Willscrlt/commons/Category suppression in templates (en), which explains in more detail how this method is used at Wikipedia. ~ Ningauble 17:54, 22 November 2008 (UTC)Reply