Template:Noselfcat

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search
[edit] [purge] Template-info.svg Template documentation

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.

wikipedia:WP:SUBCAT

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