Template:Category handler/doc: Difference between revisions

Ganaram inukshuk (talk | contribs)
m Category suppression rules and use-cases: suppressed_ns -> excluded_ns (example code had the wrong name)
Ganaram inukshuk (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{dochead|header=metatemplate}}
{{dochead|header=metatemplate}}
{{Template rating|details=Currently in-progress and used for [[Template:Template rating]]. This may be tested on other categorizing templates to determine whether any changes should be made.}}
{{Template rating|rating=ready|details=Functionally complete. See its corresponding module for more details.}}
{{clear}}
{{clear}}
{{lua}}
'''Template:Category handler''' is intended as a metatemplate that helps templates categorize pages. It also suppresses categories depending on the namespace or subpage.
'''Template:Category handler''' is intended as a metatemplate that helps templates categorize pages. It also suppresses categories depending on the namespace or subpage.


== Usage ==
=== Usage ===


Categories are entered as unnamed parameters, as shown.
Categories are entered as unnamed parameters, as shown.
Line 27: Line 26:
Typically, this template is used as part of another template, so use something like <code><nowiki>debug={{{debug|}}}</nowiki></code>, so that <code><nowiki>debug=1</nowiki></code> can be added to an instance of that template.
Typically, this template is used as part of another template, so use something like <code><nowiki>debug={{{debug|}}}</nowiki></code>, so that <code><nowiki>debug=1</nowiki></code> can be added to an instance of that template.


== Category suppression rules and use-cases ==
=== Category suppression rules and use-cases ===


By default, this metatemplate allows categories within the following namespaces: main, file, mediawiki, template, category, and module. Templates placed outside of those namespaces will not categorize those pages. Additionally, pages with the suffix /doc or /sandbox will not be categorized.
By default, this metatemplate allows categories within the following namespaces: main, file, mediawiki, template, category, and module. Templates placed outside of those namespaces will not categorize those pages. Additionally, pages with the suffix /doc or /sandbox will not be categorized.
Line 56: Line 55:
</pre>
</pre>


If placed on a template called SomeTemplate, the todo-category will contain these pages:  
If placed on the /doc subpage for a template called SomeTemplate, the todo-category will contain these pages:  
* Template:SomeTemplate (template page)
* Template:SomeTemplate (template page)
* Template:SomeTemplate/doc (template's documentation)
* Template:SomeTemplate/doc (template's documentation)


Since this template suppresses categories on /doc subpages, adding this template to Template:Todo prevents it from categorizing the documentation page, meaning only Template:SomeTemplate is categorized.
Since this template suppresses categories on /doc subpages, adding this template to Template:Todo prevents it from categorizing the documentation page, so only Template:SomeTemplate is categorized.


<pre>
<pre>