Template:Has associated category

From WhyNotWiki

Jump to: navigation, search

Include this template at the top of the main page for a category and it will put a CategoryTree there listing all other pages in the category. (Actually, it can't do that because extension parser hooks can't be transcluded in MediaWiki. :-( )

  • It will also add that page to the category, so you don't have to do that separately.

Uses Category:{{PAGENAME}} by default; pass in {{{1}}} to override and choose which category is used.

  • It will also transclude the category page's contents, which is expected to contain nothing but categories. So be sure you put <noinclude></noinclude> tags around any category you don't want members/users of the category to inherit!

For example:

[[Category:Whatever]]
[[Category:Something]]
<noinclude>[[Category:Intersection categories]]</noinclude>
  • It will also show a link to both the article page and the category page, with edit links for your convenience!

[edit] Examples

{{Has associated category|Templates}}

stuff before that line

Templates  edit   (Category  edit)

stuff after that line


[edit] Old

{{link with edit link|{{{1}}} }}

<includeonly>[[{{#if: {{{1|}}}
  | {{{1}}}
  | {{PAGENAME}} 
}}]]
{{Category:{{#if: {{{1|}}}
  | {{{1}}}
  | {{PAGENAME}} 
}}}}


Personal tools