Template:Noselfcat
Jump to navigation
Jump to search
[edit] [ ] Template documentation
This documentation is transcluded from Template:Noselfcat/doc. (edit | history)
Editors can experiment in this template's sandbox (create) and test cases (create) pages.
Subpages of this template.
Editors can experiment in this template's sandbox (create) and test cases (create) pages.
Subpages of this template.
Description
“ | Category chains formed by parent–child relationships should never form closed loops; that is, no category should be contained as a subcategory of one of its own subcategories. | ” |
This template is intended for use with navigation templates. When a category is provided, it is equivalent to the following code:
{{#ifeq:{{FULLPAGENAME}}|Category:category|<!--skip-->|[[Category:category]]}}
Usage
<includeonly>{{Noselfcat|category}}</includeonly>
Example
Avoid a closed loop on Category:Cabbage:
<includeonly>{{Noselfcat|Cabbage}}</includeonly>
When the page is saved the code becomes:
<includeonly>{{#ifeq:{{FULLPAGENAME}}|Category:Cabbage|<!--skip-->|[[Category:Cabbage]]}}</includeonly>
Table
Code on Template:Cabbage | Template:Cabbage on page | Result | Explanation |
---|---|---|---|
<includeonly>{{Noselfcat|Cabbage}}</includeonly> |
Category:Vegetables | [[Category:Cabbage]] | |
<includeonly>{{Noselfcat|Cabbage}}</includeonly> |
Cabbage | [[Category:Cabbage]] | |
<includeonly>{{Noselfcat|Cabbage}}</includeonly> |
Category:Cabbage | Skipped | |
<includeonly>{{Noselfcat}}</includeonly> |
Any page | No category provided |